Created
May 28, 2014 22:53
-
-
Save rmg/9b46920cab8e0de27c51 to your computer and use it in GitHub Desktop.
Bare miminimum LoopBack app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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)" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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