mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage-server
synced 2026-05-18 20:08:19 +00:00
- LogStreamService: singleton that extends ConsoleLogger, captures all
NestJS log output into an RxJS Subject while preserving stdout
- main.ts: uses LogStreamService.instance as app logger
- supervisor.controller.ts: new @Sse('logs/stream') endpoint pipes
log entries (timestamp, level, context, message) to connected clients
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
import type { NestExpressApplication } from '@nestjs/platform-express';
|
|
import { join } from 'path';
|
|
import { AppModule } from './app.module';
|
|
import { ConfigService } from '@nestjs/config';
|
|
import { LogStreamService } from './logging/log-stream.service';
|
|
|
|
async function bootstrap() {
|
|
const logger = LogStreamService.instance;
|
|
const app = await NestFactory.create<NestExpressApplication>(AppModule, { logger });
|
|
const config = app.get(ConfigService);
|
|
|
|
app.enableCors({
|
|
origin: config.get('corsOrigin'),
|
|
credentials: true,
|
|
});
|
|
|
|
// Serve widget.js and other static files from /public
|
|
// In dev mode __dirname = src/, in prod __dirname = dist/ — resolve from process.cwd()
|
|
app.useStaticAssets(join(process.cwd(), 'public'), {
|
|
setHeaders: (res, path) => {
|
|
if (path.endsWith('.js')) {
|
|
res.setHeader('Cache-Control', 'public, max-age=3600');
|
|
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
}
|
|
},
|
|
});
|
|
|
|
const port = config.get('port');
|
|
await app.listen(port);
|
|
console.log(`Helix Engage Server running on port ${port}`);
|
|
}
|
|
bootstrap();
|