common-cents-api/src/main.ts
2026-02-13 11:03:31 -06:00

20 lines
876 B
TypeScript

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { NestExpressApplication } from '@nestjs/platform-express';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
async function bootstrap(): Promise<void> {
const app = await NestFactory.create<NestExpressApplication>(AppModule);
const appPrefix = process.env.PREFIX ?? 'common-cents';
const config = new DocumentBuilder()
.setTitle('Common Cents API')
.setDescription('Documentation for Common Cents API')
.setVersion('1.0')
.build();
const documentFactory = () => SwaggerModule.createDocument(app, config);
SwaggerModule.setup(appPrefix + '/docs', app, documentFactory);
app.enableCors(); // TODO: Research if this is worth worrying about
app.setGlobalPrefix(appPrefix);
await app.listen(process.env.PORT ?? 3000);
}
void bootstrap();