gohorsejobs/backoffice/src/main.ts

35 lines
1.1 KiB
TypeScript

import { NestFactory } from '@nestjs/core';
import { ValidationPipe } from '@nestjs/common';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule, { rawBody: true });
app.enableCors({
origin: ['http://localhost:3000', 'https://gohorsejobs.com'],
credentials: true,
});
app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true }));
const config = new DocumentBuilder()
.setTitle('GoHorse Backoffice API')
.setDescription('SaaS Administration and Subscription Management')
.setVersion('1.0')
.addTag('Stripe')
.addTag('Plans')
.addTag('Admin Dashboard')
.addBearerAuth()
.build();
SwaggerModule.setup(
'api/docs',
app,
SwaggerModule.createDocument(app, config),
);
const port = process.env.PORT || 3001;
await app.listen(port);
console.log(`🚀 Backoffice API: http://localhost:${port}`);
console.log(`📚 Swagger docs: http://localhost:${port}/api/docs`);
}
void bootstrap();