Skip to content

Instantly share code, notes, and snippets.

@asror797
Last active February 17, 2024 14:53
Show Gist options
  • Save asror797/7e1bb388afec92872474d31535ded310 to your computer and use it in GitHub Desktop.
Save asror797/7e1bb388afec92872474d31535ded310 to your computer and use it in GitHub Desktop.
Bootstrap a NestJs application with CORS enabled
import { INestApplication } from '@nestjs/common'
import { NestFactory } from '@nestjs/core'
import { App } from './app'
setImmediate(async (): Promise<void> => {
const app = await NestFactory.create<INestApplication>(App, {
cors: true,
})
await app.listen(3000)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment