convert project from microservices to rest apis

This commit is contained in:
faris Aljohari
2024-03-10 12:49:51 +03:00
parent b3179a5c1f
commit c5537b3230
72 changed files with 155 additions and 384 deletions

39
src/main.ts Normal file
View File

@ -0,0 +1,39 @@
import { NestFactory } from '@nestjs/core';
import { AuthModule } from './app.module';
import rateLimit from 'express-rate-limit';
import helmet from 'helmet';
import { setupSwaggerAuthentication } from '../libs/common/src/util/user-auth.swagger.utils';
import { ValidationPipe } from '@nestjs/common';
async function bootstrap() {
const app = await NestFactory.create(AuthModule);
// Enable 'trust proxy' setting
app.use((req, res, next) => {
app.getHttpAdapter().getInstance().set('trust proxy', 1);
next();
});
app.enableCors();
app.use(
rateLimit({
windowMs: 5 * 60 * 1000,
max: 500,
}),
);
app.use(
helmet({
contentSecurityPolicy: false,
}),
);
setupSwaggerAuthentication(app);
app.useGlobalPipes(new ValidationPipe());
await app.listen(4001);
}
console.log('Starting auth at port 4001...');
bootstrap();