Kaynağa Gözat

定义ts别名

枫叶秋林 2 yıl önce
ebeveyn
işleme
3f5d4d1164

+ 4 - 2
src/app.module.ts

@@ -1,7 +1,8 @@
 import { Module } from '@nestjs/common'
 import { ConfigModule } from '@nestjs/config'
-import { AuthModule } from './auth/auth.module'
-import { PrismaModule } from './prisma/prisma.module'
+import { AuthModule } from '@/auth/auth.module'
+import { PrismaModule } from '@/prisma/prisma.module'
+import { CodModule } from './cod/cod.module';
 @Module({
   imports: [
     AuthModule,
@@ -9,6 +10,7 @@ import { PrismaModule } from './prisma/prisma.module'
     ConfigModule.forRoot({
       isGlobal: true,
     }),
+    CodModule,
   ],
   controllers: [],
   providers: [],

+ 1 - 1
src/auth/JwtStrategy.ts

@@ -1,4 +1,4 @@
-import { PrismaService } from './../prisma/prisma.service'
+import { PrismaService } from '@/prisma/prisma.service'
 import { ConfigService } from '@nestjs/config'
 import { ExtractJwt, Strategy } from 'passport-jwt'
 import { PassportStrategy } from '@nestjs/passport'

+ 4 - 0
src/cod/cod.controller.ts

@@ -0,0 +1,4 @@
+import { Controller } from '@nestjs/common';
+
+@Controller('cod')
+export class CodController {}

+ 9 - 0
src/cod/cod.module.ts

@@ -0,0 +1,9 @@
+import { Module } from '@nestjs/common';
+import { CodService } from './cod.service';
+import { CodController } from './cod.controller';
+
+@Module({
+  providers: [CodService],
+  controllers: [CodController]
+})
+export class CodModule {}

+ 4 - 0
src/cod/cod.service.ts

@@ -0,0 +1,4 @@
+import { Injectable } from '@nestjs/common';
+
+@Injectable()
+export class CodService {}

+ 4 - 1
tsconfig.json

@@ -16,6 +16,9 @@
     "noImplicitAny": false,
     "strictBindCallApply": false,
     "forceConsistentCasingInFileNames": false,
-    "noFallthroughCasesInSwitch": false
+    "noFallthroughCasesInSwitch": false,
+    "paths": {
+      "@/*": ["src/*"]
+    }
   }
 }