CORS Configuration

Configure Cross-Origin Resource Sharing (CORS) for your API endpoints.

Basic Setup

app.cors({
  origins: ['https://example.com'],
  methods: ['GET', 'POST'],
  headers: ['Content-Type']
});

Allow All Origins

app.cors({
  origins: ['*']
});

Options

Option Description Default
origins Allowed origins (array) []
methods Allowed HTTP methods ['GET','POST','PUT','DELETE']
headers Allowed headers ['Content-Type']