Skip to content

Commit 0197516

Browse files
author
Mick Lawitzke
authored
Update helmet.md
1 parent 55af139 commit 0197516

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
@@ -17,7 +17,7 @@ Once the installation is complete, apply it as a global middleware.
1717
```typescript
1818
import * as helmet from 'helmet';
1919
// somewhere in your initialization file
20-
app.use(helmet());
20+
await app.use(helmet());
2121
```
2222

2323
> info **Hint** If you are getting the `This expression is not callable` error while trying to import `Helmet`, you very likely have the `allowSyntheticDefaultImports` and `esModuleInterop` options set to `true` in your project's `tsconfig.json` file. If that's the case, change the import statement to: `import helmet from 'helmet'` instead.
@@ -35,12 +35,12 @@ $ npm i --save fastify-helmet
3535
```typescript
3636
import { fastifyHelmet } from 'fastify-helmet';
3737
// somewhere in your initialization file
38-
app.register(helmet);
38+
await app.register(helmet);
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(helmet, {
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(helmet, {
5757
> contentSecurityPolicy: false,
5858
> });
5959
> ```

0 commit comments

Comments
 (0)