Categories
JavaScript Answers

How to enable CORS in production with Nest.js?

Spread the love

To enable CORS in production with Nest.js, we call the enableCors method.

For instance, we write

const app = await NestFactory.create(ApplicationModule);
app.enableCors();
await app.listen(3000);

to call create to create a Nest.js app.

Then we call enableCors to enable CORS on the app.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *