Skip to content

Commit

Permalink
docs: clarify installation instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
mhweiner committed Jan 26, 2022
1 parent edf60e8 commit 1e0e10b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Expand Up @@ -13,7 +13,9 @@ Simple express request logger middleware for [jsout](https://github.com/mhweiner
npm i jsout jsout-express -D
```

## Example Usage
## Usage

Include it like you would any other middleware, but it must be last, after your error handler. If you don't do it last, then requests that fail (4xx, 5xx, etc.) won't get logged, and the duration would not be accurate.

```typescript
import {logger} from 'jsout';
Expand All @@ -22,8 +24,13 @@ import {express} from 'express';

const app = express();

// middleware, routers, etc

// must be last
app.use(logRequest);

// app.listen

```

## Log example
Expand Down

0 comments on commit 1e0e10b

Please sign in to comment.