17 lines
625 B
TypeScript
17 lines
625 B
TypeScript
import "reflect-metadata";
|
|
import { NestFactory } from "@nestjs/core";
|
|
import type { NestFastifyApplication } from "@nestjs/platform-fastify";
|
|
import { FastifyAdapter } from "@nestjs/platform-fastify";
|
|
import { AppModule, configureApp } from "./app.module.js";
|
|
|
|
export async function createApp(): Promise<NestFastifyApplication> {
|
|
const app = await NestFactory.create<NestFastifyApplication>(AppModule, new FastifyAdapter());
|
|
configureApp(app);
|
|
return app;
|
|
}
|
|
|
|
if (process.env.NODE_ENV !== "test") {
|
|
const app = await createApp();
|
|
await app.listen({ port: Number(process.env.API_PORT ?? 3001), host: "0.0.0.0" });
|
|
}
|