mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-18 05:09:39 +02:00
Central search microservice for all ManaCore apps featuring: - NestJS API on port 3021 - SearXNG meta-search engine integration (40+ search engines) - Redis caching layer for search results and extracted content - Content extraction with markdown conversion - Prometheus metrics for monitoring API Endpoints: - POST /api/v1/search - Web search with categories/engines - POST /api/v1/extract - Content extraction from URLs - POST /api/v1/extract/bulk - Bulk extraction - GET /health - Health check - GET /metrics - Prometheus metrics Search categories: general, news, science, it, images, videos Supported engines: Google, Bing, DuckDuckGo, Wikipedia, arXiv, GitHub, StackOverflow, and many more. https://claude.ai/code/session_01Rk3YVJCU3nM8uvVPghRz6r
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', 3021);
|
|
|
|
// Global prefix
|
|
app.setGlobalPrefix('api/v1');
|
|
|
|
// CORS - intern, aber für Development nützlich
|
|
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 Search Service running on port ${port}`);
|
|
logger.log(`Health check: http://localhost:${port}/health`);
|
|
logger.log(`Metrics: http://localhost:${port}/metrics`);
|
|
}
|
|
|
|
bootstrap();
|