change express to fastify

This commit is contained in:
2025-05-11 22:27:51 +08:00
parent 66da3530bf
commit 840590cad6
3 changed files with 589 additions and 129 deletions
+10 -2
View File
@@ -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();