初始化NestAPI模板

This commit is contained in:
2023-11-18 00:18:24 +08:00
commit d00d3ab968
15 changed files with 7088 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
import { Module } from '@nestjs/common';
import { WelcomeController } from '@/modules/welcome/welcome.controller';
@Module({
imports: [],
controllers: [WelcomeController],
providers: [],
})
export class AppModule {}
+17
View File
@@ -0,0 +1,17 @@
import { NestFactory } from '@nestjs/core';
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';
import { AppModule } from '@/app.module';
const bootstrap = async () => {
const app = await NestFactory.create<NestFastifyApplication>(AppModule, new FastifyAdapter(), {
cors: true,
logger: ['error', 'warn'],
});
await app.listen(2333, () => {
console.log('api: http://localhost:2333');
});
};
bootstrap();
+12
View File
@@ -0,0 +1,12 @@
import { Controller, Get } from '@nestjs/common';
/**
* 欢迎访问 Ink NestJS API
*/
@Controller()
export class WelcomeController {
@Get()
getMessage(): string {
return '访问 ink nestjs api, 了解更多 请联系邮箱 youzegehq@gmail.com';
}
}