loopback-component-storage/example/app.js

25 lines
555 B
JavaScript
Raw Normal View History

2014-01-24 17:32:48 +00:00
var loopback = require('loopback')
2014-01-24 17:44:58 +00:00
, app = module.exports = loopback();
2013-06-25 16:29:53 +00:00
2014-01-24 17:32:48 +00:00
var path = require('path');
2013-06-25 16:29:53 +00:00
2014-01-24 17:32:48 +00:00
// expose a rest api
app.use('/api', loopback.rest());
app.use(loopback.static(path.join(__dirname, 'public')));
2015-01-16 18:40:18 +00:00
app.set('port', process.env.PORT || 3000);
2013-06-25 20:06:54 +00:00
2014-01-24 17:32:48 +00:00
var ds = loopback.createDataSource({
2014-01-24 17:44:58 +00:00
connector: require('../index'),
provider: 'filesystem',
root: path.join(__dirname, 'storage')
2013-06-25 20:06:54 +00:00
});
2014-01-24 17:32:48 +00:00
var container = ds.createModel('container');
app.model(container);
app.listen(app.get('port'));
console.log('http://127.0.0.1:' + app.get('port'));