mirror of
https://github.com/feathersjs/feathers.git
synced 2026-01-25 15:23:13 +00:00
28 lines
590 B
JavaScript
28 lines
590 B
JavaScript
var feathers = require('feathers');
|
|
var errors = require('./lib/errors');
|
|
var app = feathers().configure(associations())
|
|
.use('/users', {
|
|
find: function(params, callback) {
|
|
callback(null, [{
|
|
id: 0,
|
|
name: 'testuser'
|
|
}]);
|
|
}
|
|
})
|
|
.use('/posts', {
|
|
find: function(params, callback) {
|
|
callback(null, [{
|
|
id: 0,
|
|
type: 'post',
|
|
user: params.query.userId
|
|
}, {
|
|
id: 1,
|
|
type: 'post',
|
|
user: params.query.userId
|
|
}]);
|
|
}
|
|
})
|
|
.associate('/users/:userId/posts', ['posts']);
|
|
|
|
app.listen(8080);
|