Skip to content

Commit ff82cba

Browse files
docs: minor improvements
1 parent c0c5b1e commit ff82cba

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

content/migration.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -92,24 +92,23 @@ bootstrap();
9292
9393
#### Fastify CORS
9494

95-
> warning **Warning** Allowed HTTP methods have changed to the [CORS-safelisted methods](https://fetch.spec.whatwg.org/#methods) by default. To allow other methods (e.g., `PUT`, `PATCH`, `DELETE`), you must explicitly specify them in the `methods` option.
95+
By default, only [CORS-safelisted methods](https://fetch.spec.whatwg.org/#methods) are allowed. If you need to enable additional methods (such as `PUT`, `PATCH`, or `DELETE`), you must explicitly define them in the `methods` option.
9696

9797
```typescript
9898
const methods = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']; // OR comma-delimited string 'GET,POST,PUT,PATH,DELETE'
9999

100100
const app = await NestFactory.create<NestFastifyApplication>(
101101
AppModule,
102102
new FastifyAdapter(),
103-
{ cors: { methods }}
103+
{ cors: { methods } },
104104
);
105105

106-
// OR
107-
106+
// OR alternatively, you can use the `enableCors` method
108107
const app = await NestFactory.create<NestFastifyApplication>(
109108
AppModule,
110-
new FastifyAdapter()
109+
new FastifyAdapter(),
111110
);
112-
app.enableCors({ methods );
111+
app.enableCors({ methods });
113112
```
114113

115114
#### Fastify middleware registration

0 commit comments

Comments
 (0)