How to enable CORS in production with Nest.js?

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.