mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 00:38:11 +00:00
remove localhost on swagger
This commit is contained in:
@@ -1,18 +1,18 @@
|
|||||||
import 'reflect-metadata';
|
import "reflect-metadata";
|
||||||
import { NestFactory } from '@nestjs/core';
|
import { NestFactory } from "@nestjs/core";
|
||||||
import { ValidationPipe } from '@nestjs/common';
|
import { ValidationPipe } from "@nestjs/common";
|
||||||
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
|
||||||
import { AppModule } from './app.module';
|
import { AppModule } from "./app.module";
|
||||||
import { HttpExceptionFilter } from './common/filters/http-exception.filter';
|
import { HttpExceptionFilter } from "./common/filters/http-exception.filter";
|
||||||
import { ResponseTransformInterceptor } from './common/interceptors/response-transform.interceptor';
|
import { ResponseTransformInterceptor } from "./common/interceptors/response-transform.interceptor";
|
||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
const app = await NestFactory.create(AppModule);
|
const app = await NestFactory.create(AppModule);
|
||||||
|
|
||||||
app.enableCors({
|
app.enableCors({
|
||||||
origin: [
|
origin: [
|
||||||
process.env.FRONTEND_URL ?? 'http://localhost:3000',
|
process.env.FRONTEND_URL ?? "http://localhost:3000",
|
||||||
process.env.PORTAL_URL ?? 'http://localhost:3001',
|
process.env.PORTAL_URL ?? "http://localhost:3001",
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -21,37 +21,44 @@ async function bootstrap() {
|
|||||||
app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true }));
|
app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true }));
|
||||||
|
|
||||||
const config = new DocumentBuilder()
|
const config = new DocumentBuilder()
|
||||||
.setTitle('EDR Passenger API')
|
.setTitle("EDR Passenger API")
|
||||||
.setDescription(
|
.setDescription(
|
||||||
'Ethio-Djibouti Railway Passenger API — booking lifecycle, seat inventory, payment (Telebirr, CBE Birr, eBirr, Card, Wallet), loyalty, live tracking, and support.',
|
"Ethio-Djibouti Railway Passenger API — booking lifecycle, seat inventory, payment (Telebirr, CBE Birr, eBirr, Card, Wallet), loyalty, live tracking, and support.",
|
||||||
)
|
)
|
||||||
.setVersion('1.0.0')
|
.setVersion("1.0.0")
|
||||||
.addBearerAuth({ type: 'http', scheme: 'bearer', bearerFormat: 'JWT', in: 'header' }, 'JWT-auth')
|
.addBearerAuth(
|
||||||
.addTag('Auth', 'Registration and login')
|
{ type: "http", scheme: "bearer", bearerFormat: "JWT", in: "header" },
|
||||||
.addTag('Stations', 'Station directory')
|
"JWT-auth",
|
||||||
.addTag('Fleet', 'Train services and coaches')
|
)
|
||||||
.addTag('Schedule', 'Trips and fare rules')
|
.addTag("Auth", "Registration and login")
|
||||||
.addTag('Search', 'Trip search and fare quotes')
|
.addTag("Stations", "Station directory")
|
||||||
.addTag('Seats', 'Seat maps and holds')
|
.addTag("Fleet", "Train services and coaches")
|
||||||
.addTag('Booking', 'Booking lifecycle')
|
.addTag("Schedule", "Trips and fare rules")
|
||||||
.addTag('Payment', 'Payment intents and refunds')
|
.addTag("Search", "Trip search and fare quotes")
|
||||||
.addTag('Tickets', 'QR ticket generation and validation')
|
.addTag("Seats", "Seat maps and holds")
|
||||||
.addTag('Passenger', 'Profiles, traveler profiles, saved routes')
|
.addTag("Booking", "Booking lifecycle")
|
||||||
.addTag('Notifications', 'Push and email notifications')
|
.addTag("Payment", "Payment intents and refunds")
|
||||||
.addTag('Loyalty', 'Points, tiers, and rewards')
|
.addTag("Tickets", "QR ticket generation and validation")
|
||||||
.addTag('Wallet', 'Wallet balance and ledger')
|
.addTag("Passenger", "Profiles, traveler profiles, saved routes")
|
||||||
.addTag('Promotions', 'Promo codes and campaigns')
|
.addTag("Notifications", "Push and email notifications")
|
||||||
.addTag('Live Tracking', 'Real-time trip status and crowd signals')
|
.addTag("Loyalty", "Points, tiers, and rewards")
|
||||||
.addTag('Support', 'FAQ and chat support')
|
.addTag("Wallet", "Wallet balance and ledger")
|
||||||
.addTag('Dashboard', 'Home dashboard aggregate')
|
.addTag("Promotions", "Promo codes and campaigns")
|
||||||
.addServer('http://localhost:4000', 'Development')
|
.addTag("Live Tracking", "Real-time trip status and crowd signals")
|
||||||
.addServer('https://api.edr-platform.com', 'Production')
|
.addTag("Support", "FAQ and chat support")
|
||||||
|
.addTag("Dashboard", "Home dashboard aggregate")
|
||||||
|
//.addServer('http://localhost:4000', 'Development')
|
||||||
|
// .addServer("https://api.edr-platform.com", "Production")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
const document = SwaggerModule.createDocument(app, config);
|
const document = SwaggerModule.createDocument(app, config);
|
||||||
SwaggerModule.setup('api-docs', app, document, {
|
SwaggerModule.setup("api-docs", app, document, {
|
||||||
customSiteTitle: 'EDR Passenger API',
|
customSiteTitle: "EDR Passenger API",
|
||||||
swaggerOptions: { persistAuthorization: true, docExpansion: 'none', filter: true },
|
swaggerOptions: {
|
||||||
|
persistAuthorization: true,
|
||||||
|
docExpansion: "none",
|
||||||
|
filter: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const port = process.env.PORT ?? 4000;
|
const port = process.env.PORT ?? 4000;
|
||||||
|
|||||||
Reference in New Issue
Block a user