feathers-memory
An in memory CRUD service for feathers
Getting Started
Install the module with: npm install feathers-memory --save
var feathers = require('feathers');
var memory = require('feathers-memory');
var app = feathers().use('/users', memory('users'));
Documentation
Current Error Types:
GeneralError
: 500BadRequest
: 400NotAuthenticated
: 401Forbidden
: 403NotFound
: 404Timeout
: 409Conflict
: 409PaymentError
: 409Unprocessable
: 422
Pro Tip: Feathers service adapters (ie. mongodb, memory, etc.) already emit the appropriate errors for you. :-)
Usage:
var feathers = require('feathers');
var errors = require('feathers-memory');
var app = feathers();
var userService = {
find: function(params, callback) {
callback(new this.app.errors.NotFound('User does not exist'));
},
setup: function(app){
this.app = app;
}
};
app.configure(errors())
.use('/users', userService)
.use(errors.handler);
404 Handling:
We have conveniently created a basic 404 middleware as well. To use it:
var feathers = require('feathers');
var errors = require('feathers-memory');
var app = feathers();
app.configure(errors())
.use('/users', userService)
.use(errors.missing)
.use(errors.handler);
Examples
See examples directory.
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Release History
0.1.3
0.1.2
0.1.1
0.1.0
License
Copyright (c) 2014 Eric Kryski
Licensed under the MIT license.