CORS
A way to allow Frontend interaction.
Quoting the official NestJS Docs:
Cross-origin resource sharing (CORS) is a mechanism that allows resources to be requested from another domain.
We can then notice that enabling CORS may make sense when we have an actual Frontend to interact with our Backend. To enable CORS, go to the src -> main file and here, after instantiating the application but before listening to the port, enable it.
You can check the official CORS documention to see the available options for configuring it, like which domains should be accepted, etc.
Commit - Enabling cors
Last updated