Last active
December 23, 2015 13:49
-
-
Save daffl/6644432 to your computer and use it in GitHub Desktop.
Feathers rapid start example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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