Skip to content

Commit 86fc64c

Browse files
committed
docs(): add initial documentation
1 parent 2aa1673 commit 86fc64c

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
11
# Nest Middlewares
22
Add the most common Express middlewares to your Nest app with one line.
33

4-
Currently supports:
4+
### Usage
5+
Take the name of your favorite Express middleware and prefix it with `@nest-middlewares/`.
6+
```
7+
$ npm install --save @nest-middlewares/helmet
8+
```
9+
In your module:
10+
```ts
11+
import { HelmetMiddleware } from '@nest-middlewares/helmet'; // (look around in the source code for the exact class name)
12+
13+
@Module(...)
14+
export class MyModule {
15+
configure(consumer: MiddlewaresConsumer) {
16+
// IMPORTANT! Call Middleware.configure BEFORE using it for routes
17+
HelmetMiddleware.configure( /* options as per helmet docs */ )
18+
consumer.apply(HelmetMiddleware).forRoutes(
19+
/* your routes */
20+
);
21+
}
22+
}
23+
```
24+
25+
26+
### Currently supports:
527
- **Compression**
628
- Connect RID
729
- Connect Timeout

0 commit comments

Comments
 (0)