- Cria README.md na raiz com visão global e diagrama de arquitetura - Adiciona/atualiza README.md em todos os componentes: - backend (API Go) - backoffice (NestJS) - marketplace (React/Vite) - saveinmed-bff (Python/FastAPI) - saveinmed-frontend (Next.js) - website (Fresh/Deno) - Atualiza .gitignore em todos os componentes com regras abrangentes - Cria .gitignore na raiz do projeto - Renomeia pastas para melhor organização: - backend-go → backend - backend-nest → backoffice - marketplace-front → marketplace - Documenta arquitetura, tecnologias, setup e fluxo de desenvolvimento
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
import { ValidationPipe } from '@nestjs/common';
|
|
import { ConfigService } from '@nestjs/config';
|
|
import { NestFactory } from '@nestjs/core';
|
|
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';
|
|
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
|
import fastifyCookie, { FastifyCookieOptions } from '@fastify/cookie';
|
|
import { AppModule } from './app.module';
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create<NestFastifyApplication>(
|
|
AppModule,
|
|
new FastifyAdapter(),
|
|
);
|
|
|
|
const configService = app.get(ConfigService);
|
|
|
|
const cookieOptions: FastifyCookieOptions = {
|
|
parseOptions: {
|
|
sameSite: 'lax',
|
|
},
|
|
};
|
|
|
|
await app.register(fastifyCookie as any, cookieOptions);
|
|
|
|
app.useGlobalPipes(
|
|
new ValidationPipe({
|
|
whitelist: true,
|
|
transform: true,
|
|
forbidNonWhitelisted: true,
|
|
}),
|
|
);
|
|
|
|
const swaggerConfig = new DocumentBuilder()
|
|
.setTitle('SaveInMed Backend')
|
|
.setDescription('API Gateway for users, inventory and payments')
|
|
.setVersion('1.0')
|
|
.addBearerAuth({
|
|
type: 'http',
|
|
scheme: 'bearer',
|
|
bearerFormat: 'JWT',
|
|
description: 'Access token',
|
|
})
|
|
.build();
|
|
|
|
const document = SwaggerModule.createDocument(app, swaggerConfig);
|
|
SwaggerModule.setup('docs', app, document);
|
|
|
|
const port = configService.get<number>('PORT') || 3000;
|
|
await app.listen(port, '0.0.0.0');
|
|
}
|
|
bootstrap();
|