change express to fastify
This commit is contained in:
parent
66da3530bf
commit
840590cad6
@ -23,7 +23,11 @@
|
||||
"dependencies": {
|
||||
"@nestjs/common": "^10.0.3",
|
||||
"@nestjs/core": "^10.0.3",
|
||||
"@nestjs/platform-express": "^10.0.3",
|
||||
"@nestjs/platform-fastify": "^10.0.3",
|
||||
"@nestjs/swagger": "^7.0.4",
|
||||
"class-transformer": "^0.5.1",
|
||||
"class-validator": "^0.14.2",
|
||||
"lodash": "^4.17.21",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^5.0.1",
|
||||
"rxjs": "^7.8.1"
|
||||
@ -34,8 +38,8 @@
|
||||
"@nestjs/testing": "^10.0.3",
|
||||
"@swc/cli": "^0.1.62",
|
||||
"@swc/core": "^1.3.66",
|
||||
"@types/express": "^4.17.17",
|
||||
"@types/jest": "29.5.2",
|
||||
"@types/lodash": "^4.17.16",
|
||||
"@types/node": "^20.3.1",
|
||||
"@types/supertest": "^2.0.12",
|
||||
"@typescript-eslint/eslint-plugin": "^5.60.0",
|
||||
|
698
pnpm-lock.yaml
698
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
12
src/main.ts
12
src/main.ts
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user