listpage_cli 0.0.192 → 0.0.193
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/backend-template/AGENTS.md +14 -0
- package/templates/backend-template/package.json.tmpl +1 -1
- package/templates/backend-template/src/main.ts +16 -2
- package/templates/backend-template/src/modules/app.module.ts +7 -0
- package/templates/backend-template/src/modules/prisma/prisma.module.ts +8 -0
- package/templates/backend-template/src/modules/prisma/prisma.service.ts +12 -0
- package/templates/frontend-template/package.json.tmpl +1 -1
- package/templates/backend-template/src/app.controller.ts +0 -12
- package/templates/backend-template/src/app.module.ts +0 -10
- package/templates/backend-template/src/app.service.ts +0 -8
package/package.json
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import { NestFactory } from '@nestjs/core';
|
|
2
|
-
import {
|
|
2
|
+
import { ValidationPipe } from '@nestjs/common';
|
|
3
|
+
import { ResponseInterceptor } from 'listpage-next-nest';
|
|
4
|
+
|
|
5
|
+
import { AppModule } from './modules/app.module';
|
|
3
6
|
|
|
4
7
|
async function bootstrap() {
|
|
5
8
|
const app = await NestFactory.create(AppModule);
|
|
6
|
-
|
|
9
|
+
app.useGlobalInterceptors(new ResponseInterceptor());
|
|
10
|
+
app.setGlobalPrefix('api/v1');
|
|
11
|
+
// 启用全局验证管道
|
|
12
|
+
app.useGlobalPipes(
|
|
13
|
+
new ValidationPipe({
|
|
14
|
+
whitelist: true,
|
|
15
|
+
transform: true,
|
|
16
|
+
}),
|
|
17
|
+
);
|
|
18
|
+
// 启用CORS
|
|
19
|
+
app.enableCors();
|
|
20
|
+
await app.listen(3000);
|
|
7
21
|
}
|
|
8
22
|
bootstrap();
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Controller, Get } from '@nestjs/common';
|
|
2
|
-
import { AppService } from './app.service';
|
|
3
|
-
|
|
4
|
-
@Controller()
|
|
5
|
-
export class AppController {
|
|
6
|
-
constructor(private readonly appService: AppService) {}
|
|
7
|
-
|
|
8
|
-
@Get()
|
|
9
|
-
getHello(): string {
|
|
10
|
-
return this.appService.getHello();
|
|
11
|
-
}
|
|
12
|
-
}
|