npm install nedb feathers-nedb --savePlease refer to the Feathers database adapter documentation for more details or directly at:
- NeDB - The detailed documentation for this adapter
- Extending - How to extend a database adapter
- Pagination - How to use pagination
- Querying and Sorting - The common adapter querying mechanism and sorting for the database adapter
Here's an example of a Feathers server with a messages nedb-service.
import NeDB from 'nedb';
import feathers from 'feathers';
import bodyParser from 'body-parser';
import service from 'feathers-nedb';
const db = new NeDB({
filename: './db-data/messages',
autoload: true
});
// Create a feathers instance.
var app = feathers()
// Enable REST services
.configure(rest())
// Turn on JSON parser for REST services
.use(bodyParser.json())
// Turn on URL-encoded parser for REST services
.use(bodyParser.urlencoded({extended: true}));
// Connect to the db, create and register a Feathers service.
app.use('messages', service({
Model: db,
paginate: {
default: 2,
max: 4
}
}));
// Start the server.
var port = 3030;
app.listen(port, function() {
console.log(`Feathers server listening on port ${port}`);
});You can run this example by using node example/app and going to localhost:3030/messages. You should see an empty array. That's because you don't have any Todos yet but you now have full CRUD for your new messages service.
Copyright (c) 2016
Licensed under the MIT license.
