> For the complete documentation index, see [llms.txt](https://kinesis-school-of-programming.gitbook.io/nestjs-unleashed/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kinesis-school-of-programming.gitbook.io/nestjs-unleashed/improvements-tips-module/tips/cors.md).

# CORS

A way to allow Frontend interaction.

Quoting the official [NestJS Docs](https://docs.nestjs.com/security/cors):

> 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 <mark style="color:purple;">main</mark> file and, after instantiating the application but before listening to the port, enable it.

```typescript
app.enableCors();
```

You can check the official [CORS documention](https://github.com/expressjs/cors#configuration-options) to see the available options for configuring it, like which domains should be accepted, etc.

<mark style="color:green;">**Commit**</mark> - Enabling cors
