2016-05-06 00:10:55 +00:00
|
|
|
// Copyright IBM Corp. 2014,2016. All Rights Reserved.
|
|
|
|
// Node module: loopback-component-explorer
|
|
|
|
// This file is licensed under the MIT License.
|
|
|
|
// License text available at https://opensource.org/licenses/MIT
|
|
|
|
|
2014-07-26 17:12:05 +00:00
|
|
|
var loopback = require('loopback');
|
|
|
|
var app = loopback();
|
|
|
|
var explorer = require('../');
|
|
|
|
var port = 3000;
|
|
|
|
|
|
|
|
var User = loopback.Model.extend('user', {
|
|
|
|
username: 'string',
|
|
|
|
email: 'string',
|
|
|
|
sensitiveInternalProperty: 'string',
|
2016-04-22 21:09:48 +00:00
|
|
|
}, { hidden: ['sensitiveInternalProperty'] });
|
2014-07-26 17:12:05 +00:00
|
|
|
|
|
|
|
User.attachTo(loopback.memory());
|
|
|
|
app.model(User);
|
|
|
|
|
|
|
|
var apiPath = '/api';
|
2016-05-01 14:39:59 +00:00
|
|
|
explorer(app, { basePath: apiPath });
|
2014-07-26 17:12:05 +00:00
|
|
|
app.use(apiPath, loopback.rest());
|
|
|
|
console.log('Explorer mounted at localhost:' + port + '/explorer');
|
|
|
|
|
|
|
|
app.listen(port);
|