$ git clone [email protected]:strongloop/loopback-example-middleware.git
$ cd loopback-example-middleware
$ npm install
$ node .
- Add static middleware to the files property in middleware.json
- Delete
server/boot/root.js
. - Create
client/index.html
- Start the server via
node .
and browse tolocalhost:3000
. You should seehello world
being served.
- Create a single function that all errors are passed to.
- Set
app.get('remoting').errorHandler
to call a custom error handler. - Create a
custom error middleware
to handle errors not thrown by theloopback.rest()
middleware.
Note: you must register your custom error handler in the middleware.json config file.