Files
helix-engage-server/src/main.ts
saridsa2 96ae867288 feat: server log streaming via SSE for desktop log panel
- 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>
2026-04-17 08:22:11 +05:30

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();