Files
liqa/server/src/main.ts
T
ars9 1f3a604940 feat(runs): add runs pages, polling, autorefresh indicator, and scheduler fix
- add global runs page and per-scenario runs/run-detail pages
- run detail page polls every 1s until pass/fail, cleans up on unmount
- runs list pages poll every 10s with AutoRefreshIndicator (pulse on data load)
- fix scheduler: set run to pass after empty step loop to prevent stuck in_progress
- fix table header colors and link cell color for readability
- fix play button to navigate to the new run after creation
- fix package.json import paths in server for Docker build context
2026-04-09 21:58:27 +03:00

46 lines
1.7 KiB
TypeScript

import { NestFactory } from "@nestjs/core";
import { ConfigService } from "@nestjs/config";
import { AppConfig } from "./config/app.config";
import { ValidationPipe } from "@nestjs/common";
import { TraceLogger } from "./common/trace-logger";
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
import { AppModule } from "./app.module";
import { HttpExceptionFilter } from "./filters/http-exception.filter";
import { TraceInterceptor } from "./interceptors/trace.interceptor";
import { LoggingInterceptor } from "./interceptors/logging.interceptor";
import { name as pkgName, version as pkgVersion } from "../package.json";
async function bootstrap() {
const logger = new TraceLogger("Bootstrap");
const app = await NestFactory.create(AppModule, {
logger: new TraceLogger("Bootstrap", { timestamp: true }),
});
app.useGlobalPipes(new ValidationPipe({ transform: true }));
app.useGlobalFilters(new HttpExceptionFilter());
app.useGlobalInterceptors(new TraceInterceptor(), new LoggingInterceptor());
const config = app.get<ConfigService<AppConfig, true>>(ConfigService);
const port = config.get("PORT");
const nodeEnv = config.get("NODE_ENV");
const swaggerConfig = new DocumentBuilder()
.setTitle(pkgName)
.setDescription(`${pkgName} API`)
.setVersion(pkgVersion)
.build();
const document = SwaggerModule.createDocument(app, swaggerConfig);
SwaggerModule.setup("api", app, document);
await app.listen(port);
logger.log(
`Application "${pkgName}" v${pkgVersion} running on port ${port} [${nodeEnv}]`,
);
logger.log(`Swagger UI available at http://localhost:${port}/api`);
logger.log(`MCP endpoint available at http://localhost:${port}/mcp`);
}
bootstrap();