feathers-primus
Version:
The Feathers Primus real-time API provider
59 lines (41 loc) • 2.08 kB
Markdown
# feathers-primus
> _Important:_ For Feathers v3.0.0 or later use the `@feathersjs/primus` module instead of `feathers-primus`.
[](https://greenkeeper.io/)
[](https://travis-ci.org/feathersjs/feathers-primus)
[](https://codeclimate.com/github/feathersjs/feathers-primus)
[](https://codeclimate.com/github/feathersjs/feathers-primus/coverage)
[](https://david-dm.org/feathersjs/feathers-primus)
[](https://www.npmjs.com/package/feathers-primus)
[](http://slack.feathersjs.com)
> The Feathers Primus real-time API provider
## About
This provider exposes [Feathers](http://feathersjs.com) services through [Primus](https://github.com/primus/primus) real-time APIs. It is compatible with Feathers 1.x and 2.x.
__Note:__ For the full API documentation go to [feathersjs.com/docs/providers.html](http://feathersjs.com/docs/providers.html).
## Quick example
> npm install ws
```js
import feathers from 'feathers';
import primus from 'feathers-primus';
const app = feathers()
.configure(primus({
transformer: 'websockets'
}, function(primus) {
// Set up Primus authorization here
primus.authorize(function (req, done) {
req.feathers.data = 'Hello world';
done();
});
}));
app.use('/todos', {
get: function(id, params) {
console.log(params.data); // -> 'Hello world'
return Promise.resolve({
id,
description: `You have to do ${name}!`
});
}
});
```
## License
Copyright (c) 2015
Licensed under the [MIT license](LICENSE).