★ wanayoo — archive 1999 https://github.com/feathersjs/feathers-memoryNouvelle recherche | Portail wanayoo
Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
An in memory feathers service
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.md

feathers-memory Build StatusCode Climate

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')();

app.configure(feathers.rest()).use('/users', memory);

Documentation

API

The feathers-memory service follows the same convention as all the other services. Therefore, it provides the following methods:

find, get, create, update, patch, remove and setup.

var memoryService = {
  find: function(params, callback) {},
  get: function(id, params, callback) {},
  create: function(data, params, callback) {},
  update: function(id, data, params, callback) {},
  patch: function(id, data, params, callback) {},
  remove: function(id, params, callback) {},
  setup: function(app) {}
}

Usage:

var feathers = require('feathers');
var memory = require('feathers-memory')();
var app = feathers();

app.configure(feathers.rest())
   .use('/users', memory)
   .listen(8080);

Extending:

You can also extend any of the feathers services to do something custom.

var feathers = require('feathers');
var memory = require('feathers-memory')();
var app = feathers();

var myUserService = memory.extend({
  find: function(params, cb){
    // Do something awesome!

    console.log('I am extending the find method');

    this._super.apply(this, arguments);
  }
});

app.configure(feathers.rest())
   .use('/users', myUserService)
   .listen(8080);

Advanced Querying

You are probably also going to want to filter your data. You can do that by passing options via the body or in a query string. Like so:

GET /users?name=eric&limit=10&skip=10

Sort:

GET /users?sort[]=name&sort[]=age

Order:

GET /users?order=ascending

Skip:

GET /users?skip=10

Limit:

GET /users?limit=10

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.3.0

  • Fixing how the module is exported.
  • Adding PATCH support back in

0.2.2

  • Minor bug fixes

0.2.1

0.2.0

  • Unknown

0.1.2

  • Unknown

0.1.1

  • Unknown

0.1.0

  • Initial release

License

Copyright (c) 2014 Eric Kryski Licensed under the MIT license.

Something went wrong with that request. Please try again.