21 lines
684 B
TypeScript
21 lines
684 B
TypeScript
import "reflect-metadata";
|
|
import cookie from "@fastify/cookie";
|
|
import "@fastify/cookie";
|
|
import { NestFactory } from "@nestjs/core";
|
|
import { FastifyAdapter, NestFastifyApplication } from "@nestjs/platform-fastify";
|
|
import { AppModule } from "./app.module.js";
|
|
import { loadConfig } from "./config/env.js";
|
|
|
|
async function bootstrap() {
|
|
const config = loadConfig();
|
|
const app = await NestFactory.create<NestFastifyApplication>(AppModule, new FastifyAdapter({ logger: true }));
|
|
await app.register(cookie as never, { secret: config.jwtSecret });
|
|
app.enableCors({
|
|
origin: true,
|
|
credentials: true
|
|
});
|
|
await app.listen(config.port, config.host);
|
|
}
|
|
|
|
void bootstrap();
|