feat: complete admin panel and backend admin api migration
This commit is contained in:
+12
-2
@@ -1,15 +1,25 @@
|
||||
import 'reflect-metadata';
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { NestExpressApplication } from '@nestjs/platform-express';
|
||||
import { join } from 'node:path';
|
||||
import { AppModule } from './app.module';
|
||||
import { PrismaExceptionFilter } from './prisma/prisma-exception.filter';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
const app = await NestFactory.create<NestExpressApplication>(AppModule);
|
||||
app.setGlobalPrefix('api');
|
||||
app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true }));
|
||||
app.useGlobalFilters(new PrismaExceptionFilter());
|
||||
app.enableCors();
|
||||
await app.listen(process.env.PORT ?? 3000);
|
||||
// Uploaded files, mounted OUTSIDE the /api prefix so the URLs stored on
|
||||
// UploadedFile.url ("/uploads/<name>") resolve directly.
|
||||
app.useStaticAssets(process.env.UPLOAD_DIR ?? join(process.cwd(), 'storage', 'uploads'), {
|
||||
prefix: '/uploads/',
|
||||
index: false,
|
||||
dotfiles: 'deny',
|
||||
});
|
||||
// Bind all interfaces explicitly so the container is reachable from nginx.
|
||||
await app.listen(process.env.PORT ?? 3000, '0.0.0.0');
|
||||
}
|
||||
bootstrap();
|
||||
|
||||
Reference in New Issue
Block a user