example: use PersistedModel instead of Model

Use `PersistedModel` as a base for the Product model to ensure
it has some methods to inspect in the explorer.
This commit is contained in:
Miroslav Bajtoš 2014-10-16 10:17:47 +02:00
parent 0f5ab45c0b
commit 604248ec17
1 changed files with 2 additions and 2 deletions

View File

@ -3,7 +3,7 @@ var app = loopback();
var explorer = require('../');
var port = 3000;
var Product = loopback.Model.extend('product', {
var Product = loopback.PersistedModel.extend('product', {
foo: {type: 'string', required: true},
bar: 'string',
aNum: {type: 'number', min: 1, max: 10, required: true, default: 5}
@ -14,6 +14,6 @@ app.model(Product);
var apiPath = '/api';
app.use('/explorer', explorer(app, {basePath: apiPath}));
app.use(apiPath, loopback.rest());
console.log('Explorer mounted at localhost:' + port + '/explorer');
console.log('Explorer mounted at http://localhost:' + port + '/explorer');
app.listen(port);