Skip to content

Commit

Permalink
Merge pull request #286 from quinn/patch-1
Browse files Browse the repository at this point in the history
Update README.md with middleware example
  • Loading branch information
jsumners authored Apr 28, 2023
2 parents 15b69ae + b943deb commit fff8525
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 Express 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 fff8525

Please sign in to comment.