Skip to content

Commit e1ba2a9

Browse files
authored
1 parent 80862d0 commit e1ba2a9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#loopback-example-middleware
1+
# loopback-example-middleware
22
```
33
$ git clone [email protected]:strongloop/loopback-example-middleware.git
44
$ cd loopback-example-middleware
@@ -8,14 +8,13 @@ $ node .
88

99
- [How do you serve static content via static middleware?](https://github.com/strongloop/loopback-example-middleware#how-do-you-serve-static-content-via-static-middleware)
1010

11-
#How do you serve static content via static middleware?
11+
## How do you serve static content via static middleware?
1212
1. Add static middleware to the [files property](https://github.com/strongloop/loopback-example-middleware/blob/master/server/middleware.json#L17-L19) in middleware.json
1313
2. Delete [`server/boot/root.js`](https://github.com/strongloop/loopback-example-middleware/blob/master/server/boot).
1414
3. Create [`client/index.html`](https://github.com/strongloop/loopback-example-middleware/blob/master/client/index.html)
1515
4. Start the server via `node .` and browse to [`localhost:3000`](http://localhost:3000). You should see `hello world` being served.
1616

17-
18-
#How do you create a custom error message for all errors?
17+
## How do you create a custom error message for all errors?
1918
1. Create a [single function](https://github.com/strongloop/loopback-example-middleware/blob/master/server/server.js#L33-l41) that all errors are passed to.
2019
2. Set [`app.get('remoting').errorHandler`](https://github.com/strongloop/loopback-example-middleware/blob/master/server/server.js#L23-l31) to call a custom error handler.
2120
3. Create a [`custom error middleware`](https://github.com/strongloop/loopback-example-middleware/blob/master/server/middleware/custom-error.js) to handle errors not thrown by the `loopback.rest()` middleware.

0 commit comments

Comments
 (0)