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