Some checks failed
Backend: - AuthModule with register, login, logout, refresh, profile endpoints - JwtAuthGuard (global, opt-out via @Public) + RolesGuard (@Roles) - PrismaModule with SQLite via @prisma/adapter-libsql (Prisma 7) - Auth configuration in configuration.ts Frontend: - Auth context with session restoration via refresh cookie - Login, Register, Profile pages with ProtectedRoute - Auto-refresh on 401 with token rotation - API client refactored for auth headers Russian text: auth flows translated to Russian All text translated: auth pages, profile, layout, loading states
40 lines
1.5 KiB
TypeScript
40 lines
1.5 KiB
TypeScript
import 'reflect-metadata';
|
|
import { NestFactory } from '@nestjs/core';
|
|
import { AppModule } from './app.module';
|
|
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
|
import { HttpExceptionFilter } from './common/filters/http-exception.filter';
|
|
import { TransformInterceptor } from './common/interceptors/transform.interceptor';
|
|
import { RequestLoggingMiddleware } from './common/middleware/request-logging.middleware';
|
|
import { ValidationPipe } from '@nestjs/common';
|
|
import cookieParser from 'cookie-parser';
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create(AppModule);
|
|
|
|
app.setGlobalPrefix('api/v1');
|
|
|
|
app.useGlobalPipes(new ValidationPipe({ transform: true, whitelist: true }));
|
|
app.useGlobalFilters(new HttpExceptionFilter());
|
|
app.useGlobalInterceptors(new TransformInterceptor());
|
|
app.use(cookieParser());
|
|
|
|
const reqLogMiddleware = new RequestLoggingMiddleware();
|
|
app.use(reqLogMiddleware.use.bind(reqLogMiddleware));
|
|
|
|
app.enableCors({ origin: true, credentials: true });
|
|
|
|
const config = new DocumentBuilder()
|
|
.setTitle('MoexVibe API')
|
|
.setVersion('1.0.0')
|
|
.addBearerAuth()
|
|
.build();
|
|
const document = SwaggerModule.createDocument(app, config);
|
|
SwaggerModule.setup('api/docs', app, document);
|
|
|
|
const port = process.env.PORT || 3000;
|
|
await app.listen(port);
|
|
console.log(`MoexVibe API running on http://localhost:${port}/api/v1`);
|
|
console.log(`Swagger docs: http://localhost:${port}/api/docs`);
|
|
}
|
|
bootstrap();
|