2018-08-20 19:58:09 -07:00
..
2018-08-20 19:58:09 -07:00
2018-08-20 19:58:09 -07:00
2018-08-20 19:58:09 -07:00
2018-08-20 19:58:09 -07:00
2018-08-20 19:58:09 -07:00
2018-08-20 19:58:09 -07:00
2018-08-20 19:58:09 -07:00
2018-08-20 19:58:09 -07:00
2018-08-20 19:58:09 -07:00
2018-08-20 19:58:09 -07:00

feathers-errors Build Status

Error handling mixin for Feathers services.

Getting Started

Install the module with: npm install feathers-errors --save

var feathers = require('feathers');
var errors = require('feathers-errors');

var app = feathers().configure(errors)
  .use('/users', userService)
  .use('/posts', postsService)
  .use(errors.handler);

Documentation

Definition and use with REST URIs:

// Both associations should only work if there is a /users service registered already
app.use('/users', userService)
  .use('/posts', postsService)
  .use('/accounts', accountService);

// Pass service name in an array
// Calls postsService.findAll({ userId: <userId> })
app.associate('/users/:userId/posts', ['posts']);

// Calls userService.get(<userId>) then calls
// accountService.get(user.account)
app.associate('/users/:userId/account', 'accounts');

For SocketIO:

socket.emit('/users/:userId/posts', { userId: 123 }, function(error, posts) {
});

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

(Nothing yet)

License

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