feat: Initialize main NestJS application in 'src/main.ts'
This commit introduces 'src/main.ts' which starts up the NestJS application. It uses Fastify as the underlying HTTP server and leverages the helmet middleware for security. The CORS is also enabled for the application that will listen on the specified APP_PORT or default to port 3333.
This commit is contained in:
parent
481727ecf0
commit
25d69823fa
19
src/main.ts
Normal file
19
src/main.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { randomStringGenerator } from "@nestjs/common/utils/random-string-generator.util";
|
||||
import { NestFactory } from "@nestjs/core";
|
||||
import {
|
||||
FastifyAdapter,
|
||||
type NestFastifyApplication,
|
||||
} from '@nestjs/platform-fastify';
|
||||
import { AppModule } from "./app.module";
|
||||
import helmet from "helmet";
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create<NestFastifyApplication>(
|
||||
AppModule,
|
||||
new FastifyAdapter({logger: true})
|
||||
);
|
||||
app.use(helmet())
|
||||
app.enableCors();
|
||||
await app.listen(process.env.APP_PORT || 3333, '0.0.0.0');
|
||||
}
|
||||
bootstrap();
|
Loading…
x
Reference in New Issue
Block a user