【发布时间】:2021-09-02 17:00:04
【问题描述】:
我正在使用 NestJS 构建一个后端应用程序,并且我正在尝试使用 fastify 而不是 express 作为底层框架。我正在按照文档 (available here) 使用 fastify,但是我遇到了以下类型问题:
Type 'NestFastifyApplication' does not satisfy the constraint 'INestApplication'.
Type 'NestFastifyApplication' is missing the following properties from type
'INestApplication': use, enableCors, enableVersioning, listenAsync, and 22 more
代码如下:
import { NestFactory } from '@nestjs/core';
import {
FastifyAdapter,
NestFastifyApplication,
} from '@nestjs/platform-fastify';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create<NestFastifyApplication>(
AppModule,
new FastifyAdapter(),
);
await app.listen(3001);
}
bootstrap();
【问题讨论】:
标签: node.js typescript nestjs dependency-management fastify