added initial swagger docs

This commit is contained in:
Joe Arndt 2026-02-13 11:03:31 -06:00
parent f72047b18e
commit b7acc9e352
7 changed files with 80 additions and 16 deletions

View file

@ -1,11 +1,20 @@
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);
app.enableCors();
app.setGlobalPrefix(process.env.PREFIX ?? 'common-cents');
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();