mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-19 12:21:23 +02:00
🔧 chore: create @manacore/shared-nestjs-setup and migrate 8 backends
- Create shared package with bootstrapApp(), configureCors(), configureValidation() - Migrate: chat, calendar, contacts, zitare, clock, planta, presi, nutriphi - Skip complex backends: manadeck, picture, todo, skilltree, questions, storage Savings: ~280 LOC (8 backends × 35 LOC each)
This commit is contained in:
parent
840f6d7ff3
commit
fbd315eac0
21 changed files with 280 additions and 314 deletions
|
|
@ -25,6 +25,7 @@
|
|||
"dependencies": {
|
||||
"@nutriphi/shared": "workspace:*",
|
||||
"@manacore/shared-nestjs-auth": "workspace:*",
|
||||
"@manacore/shared-nestjs-setup": "workspace:*",
|
||||
"@google/generative-ai": "^0.21.0",
|
||||
"@nestjs/common": "^10.4.15",
|
||||
"@nestjs/config": "^3.3.0",
|
||||
|
|
|
|||
|
|
@ -1,35 +1,9 @@
|
|||
import { NestFactory } from '@nestjs/core';
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { bootstrapApp } from '@manacore/shared-nestjs-setup';
|
||||
import { AppModule } from './app.module';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
|
||||
// Enable CORS
|
||||
app.enableCors({
|
||||
origin: process.env.CORS_ORIGINS?.split(',') || [
|
||||
'http://localhost:5180',
|
||||
'http://localhost:4323',
|
||||
'http://localhost:3001',
|
||||
],
|
||||
credentials: true,
|
||||
});
|
||||
|
||||
// Global validation pipe
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
whitelist: true,
|
||||
transform: true,
|
||||
forbidNonWhitelisted: true,
|
||||
})
|
||||
);
|
||||
|
||||
// Global prefix
|
||||
app.setGlobalPrefix('api/v1');
|
||||
|
||||
const port = process.env.PORT || 3023;
|
||||
await app.listen(port);
|
||||
console.log(`NutriPhi Backend running on http://localhost:${port}`);
|
||||
}
|
||||
|
||||
bootstrap();
|
||||
bootstrapApp(AppModule, {
|
||||
defaultPort: 3023,
|
||||
serviceName: 'NutriPhi',
|
||||
additionalCorsOrigins: ['http://localhost:5180', 'http://localhost:4323'],
|
||||
excludeFromPrefix: [], // no exclusions
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue