2013-11-05 19:16:59 +00:00
|
|
|
var loopback = require('loopback');
|
|
|
|
var app = loopback();
|
|
|
|
var explorer = require('../');
|
2014-07-04 19:28:47 +00:00
|
|
|
var port = 3000;
|
2013-11-05 19:16:59 +00:00
|
|
|
|
2014-07-04 22:09:03 +00:00
|
|
|
var Product = loopback.Model.extend('product', {
|
|
|
|
foo: {type: 'string', required: true},
|
|
|
|
bar: 'string',
|
|
|
|
aNum: {type: 'number', min: 1, max: 10, required: true, default: 5}
|
|
|
|
});
|
2013-11-05 19:16:59 +00:00
|
|
|
Product.attachTo(loopback.memory());
|
|
|
|
app.model(Product);
|
|
|
|
|
2014-07-09 22:38:05 +00:00
|
|
|
var apiPath = '/api';
|
|
|
|
app.use('/explorer', explorer(app, {basePath: apiPath}));
|
|
|
|
app.use(apiPath, loopback.rest());
|
|
|
|
console.log('Explorer mounted at localhost:' + port + '/explorer');
|
2013-11-05 19:16:59 +00:00
|
|
|
|
2014-07-04 19:28:47 +00:00
|
|
|
app.listen(port);
|