change express to fastify
This commit is contained in:
+10
-2
@@ -1,9 +1,17 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
|
||||
import { AppModule } from './app.module';
|
||||
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
await app.listen(process.env.PORT ?? 3000);
|
||||
const app = await NestFactory.create<NestFastifyApplication>(AppModule, new FastifyAdapter(), {
|
||||
cors: true,
|
||||
logger: ['error', 'warn'],
|
||||
});
|
||||
app.setGlobalPrefix('api');
|
||||
await app.listen(process.env.PORT ?? 3000, () => {
|
||||
console.log('api: http://localhost:3000');
|
||||
});
|
||||
}
|
||||
|
||||
bootstrap();
|
||||
|
||||
Reference in New Issue
Block a user