feat: initialize NestJS application with global error handling and response standardization

- Added nest-cli.json for NestJS configuration.
- Created package.json with dependencies and scripts for building, testing, and linting.
- Implemented AppController and AppService with a basic "Hello World!" response.
- Introduced ContextModule and ContextService for managing request-scoped context.
- Developed custom decorators for response messages and standardized error handling.
- Created global exception filter to handle various error types and format responses.
- Implemented response standardization interceptor to wrap successful responses.
- Added middleware for generating unique request IDs.
- Established DTOs for API responses and error handling.
- Configured TypeScript settings for the project.
- Set up Jest for testing with end-to-end test cases.
This commit is contained in:
2025-11-18 06:11:40 +06:00
commit e04b14265b
30 changed files with 3076 additions and 0 deletions

25
test/app.e2e-spec.ts Normal file
View File

@@ -0,0 +1,25 @@
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import request from 'supertest';
import { App } from 'supertest/types';
import { AppModule } from './../src/app.module';
describe('AppController (e2e)', () => {
let app: INestApplication<App>;
beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
}).compile();
app = moduleFixture.createNestApplication();
await app.init();
});
it('/ (GET)', () => {
return request(app.getHttpServer())
.get('/')
.expect(200)
.expect('Hello World!');
});
});