2020-02-10 18:57:12 +00:00
|
|
|
// Copyright IBM Corp. 2016,2019. All Rights Reserved.
|
2016-05-03 23:18:18 +00:00
|
|
|
// Node module: loopback-component-storage
|
|
|
|
// This file is licensed under the Artistic License 2.0.
|
|
|
|
// License text available at https://opensource.org/licenses/Artistic-2.0
|
2019-05-07 13:41:29 +00:00
|
|
|
|
2016-10-18 22:48:59 +00:00
|
|
|
'use strict';
|
2016-05-03 23:18:18 +00:00
|
|
|
|
2016-10-18 22:48:59 +00:00
|
|
|
var loopback = require('loopback');
|
|
|
|
var 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
|
2014-03-22 00:28:57 +00:00
|
|
|
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',
|
2016-10-18 22:06:55 +00:00
|
|
|
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'));
|