Support LiteSpeed /server path via GLOBAL_PREFIX
Allow Nest prefix server/api and overlay dist from git onto the deploy bundle so proxy paths match without a full retar. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+6
-4
@@ -6,7 +6,9 @@ import { AppModule } from './app.module';
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
|
||||
app.setGlobalPrefix('api');
|
||||
// پشت LiteSpeed روی /server → GLOBAL_PREFIX=server/api
|
||||
const globalPrefix = process.env.GLOBAL_PREFIX || 'api';
|
||||
app.setGlobalPrefix(globalPrefix);
|
||||
app.enableCors({
|
||||
origin: true,
|
||||
credentials: true,
|
||||
@@ -27,11 +29,11 @@ async function bootstrap() {
|
||||
.addBearerAuth()
|
||||
.build();
|
||||
const document = SwaggerModule.createDocument(app, swaggerConfig);
|
||||
SwaggerModule.setup('api/docs', app, document);
|
||||
SwaggerModule.setup(`${globalPrefix}/docs`, app, document);
|
||||
|
||||
const port = process.env.PORT ?? 3000;
|
||||
await app.listen(port);
|
||||
console.log(`Fabric Trade API listening on http://localhost:${port}/api`);
|
||||
console.log(`Swagger docs at http://localhost:${port}/api/docs`);
|
||||
console.log(`Fabric Trade API listening on http://localhost:${port}/${globalPrefix}`);
|
||||
console.log(`Swagger docs at http://localhost:${port}/${globalPrefix}/docs`);
|
||||
}
|
||||
bootstrap();
|
||||
|
||||
Reference in New Issue
Block a user