mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-17 18:09:40 +02:00
NestJS notification microservice for email, push, Matrix, and webhook notifications across all ManaCore apps. Features: - Multi-channel delivery (email, push, Matrix, webhook) - Handlebars template engine with defaults - User notification preferences - BullMQ async job processing - Delivery tracking and logging - Prometheus metrics Includes @manacore/notify-client package for NestJS integration.
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
import { ValidationPipe, Logger } from '@nestjs/common';
|
|
import { ConfigService } from '@nestjs/config';
|
|
import { AppModule } from './app.module';
|
|
import { HttpExceptionFilter } from './common/filters/http-exception.filter';
|
|
|
|
async function bootstrap() {
|
|
const logger = new Logger('Bootstrap');
|
|
|
|
const app = await NestFactory.create(AppModule);
|
|
|
|
const configService = app.get(ConfigService);
|
|
const port = configService.get<number>('port', 3040);
|
|
|
|
// Global prefix
|
|
app.setGlobalPrefix('api/v1');
|
|
|
|
// CORS
|
|
app.enableCors({
|
|
origin: configService.get<string[]>('cors.origins', ['http://localhost:*']),
|
|
credentials: true,
|
|
});
|
|
|
|
// Global pipes
|
|
app.useGlobalPipes(
|
|
new ValidationPipe({
|
|
whitelist: true,
|
|
transform: true,
|
|
forbidNonWhitelisted: true,
|
|
})
|
|
);
|
|
|
|
// Global filters
|
|
app.useGlobalFilters(new HttpExceptionFilter());
|
|
|
|
await app.listen(port);
|
|
logger.log(`Mana Notify Service running on port ${port}`);
|
|
logger.log(`Health check: http://localhost:${port}/health`);
|
|
logger.log(`Metrics: http://localhost:${port}/metrics`);
|
|
}
|
|
|
|
bootstrap();
|