* refactor: move swagger to src/swagger * refactor: standalone swagger generation script * refactor: generate only 1 swagger file * feat: github action checking breaking changes * chore: ensure openapi file is formatted * chore: run breaking change check on label * chore: have only 1 swagger file * fix: run breaking changes check on workflow call * refactor: pr breaking jobs dependency * fix: copy swagger module * refactor: add check-label as dep * refactor: breaking changes check part of v2 e2e workflow * refactor: run breaking changes before e2e * chore: add vapid env keys to workflow * chore: add CI_JWT_SECRET to e2e api v2 * chore: add NODE_ENV --------- Co-authored-by: cal.com <morgan@cal.com>
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import type { AppConfig } from "@/config/type";
|
|
import { Logger } from "@nestjs/common";
|
|
import { ConfigService } from "@nestjs/config";
|
|
import { NestFactory } from "@nestjs/core";
|
|
import type { NestExpressApplication } from "@nestjs/platform-express";
|
|
import "dotenv/config";
|
|
import { WinstonModule } from "nest-winston";
|
|
|
|
import { bootstrap } from "./app";
|
|
import { AppModule } from "./app.module";
|
|
import { loggerConfig } from "./lib/logger";
|
|
import { generateSwaggerForApp } from "./swagger/generate-swagger";
|
|
|
|
run().catch((error: Error) => {
|
|
console.error("Failed to start Cal Platform API", { error: error.stack });
|
|
process.exit(1);
|
|
});
|
|
|
|
async function run() {
|
|
const app = await createNestApp();
|
|
const logger = new Logger("App");
|
|
|
|
try {
|
|
bootstrap(app);
|
|
const port = app.get(ConfigService<AppConfig, true>).get("api.port", { infer: true });
|
|
generateSwaggerForApp(app);
|
|
await app.listen(port);
|
|
logger.log(`Application started on port: ${port}`);
|
|
} catch (error) {
|
|
console.error(error);
|
|
logger.error("Application crashed", {
|
|
error,
|
|
});
|
|
}
|
|
}
|
|
|
|
export async function createNestApp() {
|
|
return NestFactory.create<NestExpressApplication>(AppModule, {
|
|
logger: WinstonModule.createLogger(loggerConfig()),
|
|
bodyParser: false,
|
|
});
|
|
}
|