feat: 支持教学图鉴

This commit is contained in:
richarjiang
2026-10-18 17:26:16 +08:00
parent 3635b2a906
commit 3dc56a113b
29 changed files with 3056 additions and 5 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 162 KiB

View File

@@ -1,4 +1,6 @@
import { NestFactory } from '@nestjs/core'
import { NestExpressApplication } from '@nestjs/platform-express'
import { join } from 'path'
import { Logger, ValidationPipe } from '@nestjs/common'
import { ConfigService } from '@nestjs/config'
import { WinstonModule } from 'nest-winston'
@@ -11,9 +13,20 @@ import { ApiExceptionFilter } from './common/filters/api-exception.filter'
async function bootstrap() {
const logger = WinstonModule.createLogger(loggerConfig)
const app = await NestFactory.create(AppModule, { logger })
const app = await NestFactory.create<NestExpressApplication>(AppModule, { logger })
const configService = app.get(ConfigService)
// Public, dependency-free educational pages; keep them outside the JSON API prefix.
app.useStaticAssets(join(__dirname, '..', 'public', 'learn'), {
prefix: '/learn/',
index: 'index.html',
maxAge: 0,
setHeaders: (response) => {
response.setHeader('X-Content-Type-Options', 'nosniff')
response.setHeader('Referrer-Policy', 'strict-origin-when-cross-origin')
},
})
app.setGlobalPrefix('api')
app.useGlobalPipes(
new ValidationPipe({