Skip to content

Commit 86594ee

Browse files
Merge pull request #1853 from MickL/patch-7
Update helmet.md
2 parents bbbfbd0 + da0e6c6 commit 86594ee

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

content/security/helmet.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ $ npm i --save fastify-helmet
3333
[fastify-helmet](https://github.com/fastify/fastify-helmet) should not be used as a middleware, but as a [Fastify plugin](https://www.fastify.io/docs/latest/Plugins/), i.e., by using `app.register()`:
3434

3535
```typescript
36-
import * as helmet from 'fastify-helmet';
36+
import { fastifyHelmet } from 'fastify-helmet';
3737
// somewhere in your initialization file
38-
app.register(helmet);
38+
await app.register(fastifyHelmet);
3939
```
4040
> warning **Warning** When using `apollo-server-fastify` and `fastify-helmet`, there may be a problem with [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) on the GraphQL playground, to solve this collision, configure the CSP as shown below:
4141
>
4242
> ```typescript
43-
> app.register(helmet, {
43+
> await app.register(fastifyHelmet, {
4444
> contentSecurityPolicy: {
4545
> directives: {
4646
> defaultSrc: [`'self'`],
@@ -53,7 +53,7 @@ app.register(helmet);
5353
> });
5454
>
5555
> // If you are not going to use CSP at all, you can use this:
56-
> app.register(helmet, {
56+
> await app.register(fastifyHelmet, {
5757
> contentSecurityPolicy: false,
5858
> });
5959
> ```

0 commit comments

Comments
 (0)