loopback/example/colors/app.js

23 lines
416 B
JavaScript
Raw Normal View History

2013-07-16 17:49:25 +00:00
var loopback = require('../../');
var app = loopback();
2013-05-01 19:11:43 +00:00
2013-07-16 17:49:25 +00:00
app.use(loopback.rest());
2013-05-01 19:11:43 +00:00
2013-05-24 22:08:23 +00:00
var schema = {
name: String
};
2013-05-01 19:11:43 +00:00
2013-05-24 22:08:23 +00:00
var Color = app.model('color', schema);
2013-05-01 19:11:43 +00:00
2013-05-24 22:08:23 +00:00
app.dataSource('db', {adapter: 'memory'});
Color.dataSource('db');
Color.create({name: 'red'});
Color.create({name: 'green'});
Color.create({name: 'blue'});
2013-05-01 19:11:43 +00:00
app.listen(3000);
console.log('a list of colors is available at http://localhost:3000/colors');