Skip to content

Commit

Permalink
Update README.md with middleware example
Browse files Browse the repository at this point in the history
fixes #285
  • Loading branch information
quinn authored Apr 19, 2023
1 parent 15b69ae commit f876e55
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,23 @@ $ node example.js | pino-pretty

#### Examples

##### Use as middleware
```js
const express = require('express')
const logger = require('pino-http')

const app = express()

app.use(logger())

function handle (req, res) {
req.log.info('something else')
res.end('hello world')
}

app.listen(3000)
```

##### Logger options

```js
Expand Down

0 comments on commit f876e55

Please sign in to comment.