Skip to content

Instantly share code, notes, and snippets.

@rmg
Created May 28, 2014 22:53
Show Gist options
  • Save rmg/9b46920cab8e0de27c51 to your computer and use it in GitHub Desktop.
Save rmg/9b46920cab8e0de27c51 to your computer and use it in GitHub Desktop.
Bare miminimum LoopBack app
{
"error": {
"name": "Error",
"status": 404,
"message": "Shared class \"person\" has no method handling GET /",
"statusCode": 404,
"stack": "Error: Shared class \"person\" has no method handling GET /\n at Object.restRemoteMethodNotFound [as handle] (/Users/ryan/work/strong-remoting/lib/rest-adapter.js:205:17)\n at next (/Users/ryan/work/strong-remoting/node_modules/express/node_modules/connect/lib/proto.js:193:15)\n at Object.expressInit [as handle] (/Users/ryan/work/strong-remoting/node_modules/express/lib/middleware.js:30:5)\n at next (/Users/ryan/work/strong-remoting/node_modules/express/node_modules/connect/lib/proto.js:193:15)\n at Object.query [as handle] (/Users/ryan/work/strong-remoting/node_modules/express/node_modules/connect/lib/middleware/query.js:45:5)\n at next (/Users/ryan/work/strong-remoting/node_modules/express/node_modules/connect/lib/proto.js:193:15)\n at Function.app.handle (/Users/ryan/work/strong-remoting/node_modules/express/node_modules/connect/lib/proto.js:201:3)\n at Object.fn [as handle] (/Users/ryan/work/strong-remoting/node_modules/express/lib/application.js:118:11)\n at next (/Users/ryan/work/strong-remoting/node_modules/express/node_modules/connect/lib/proto.js:193:15)\n at cors (/Users/ryan/work/strong-remoting/node_modules/cors/lib/index.js:116:7)"
}
}
var loopback = require('loopback');
var http = require('http');
var app = loopback();
var ds = loopback.memory();
var Person = ds.createModel('person', {name: String});
Person.create([{name: 'Bob'}, {name: 'Bruce'}]);
app.model(Person);
app.use(loopback.rest());
app.listen(function() {
http.get({
host: this.address().address,
port: this.address().port,
path: '/people',
}, done);
});
function done(res) {
res.pipe(process.stdout);
res.on('end', process.exit);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment