21 lines
747 B
TypeScript
21 lines
747 B
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
import { AppModule } from './app.module';
|
|
import supertokens from 'supertokens-node';
|
|
import { SupertokensExceptionFilter } from './auth/filters/auth.filter';
|
|
import { PrismaService } from 'prisma/prisma.service';
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create(AppModule);
|
|
app.enableCors({
|
|
origin: [process.env.WEBAPP_URL, 'https://studio.apollographql.com'],
|
|
allowedHeaders: ['content-type', ...supertokens.getAllCORSHeaders()],
|
|
credentials: true,
|
|
});
|
|
app.useGlobalFilters(new SupertokensExceptionFilter());
|
|
const prismaService = app.get(PrismaService);
|
|
await prismaService.enableShutdownHooks(app);
|
|
|
|
await app.listen(process.env.APP_PORT);
|
|
}
|
|
bootstrap();
|