Skip to content

Instantly share code, notes, and snippets.

@daffl
Last active December 23, 2015 13:49
Show Gist options
  • Save daffl/6644432 to your computer and use it in GitHub Desktop.
Save daffl/6644432 to your computer and use it in GitHub Desktop.
Feathers rapid start example
var feathers = require('feathers');
var bodyParser = require('body-parser');
var todoService = {
todos: [],
// Return all todos from this service
find: function(params, callback) {
callback(null, this.todos);
},
// Create a new Todo with the given data
create: function(data, params, callback) {
data.id = this.todos.length;
this.todos.push(data);
callback(null, data);
}
};
feathers()
.configure(feathers.rest())
.configure(feathers.socketio())
.use(bodyParser())
.use('/todos', todoService)
.listen(8000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment