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:
35
eslint.config.mjs
Normal file
35
eslint.config.mjs
Normal file
@@ -0,0 +1,35 @@
|
||||
// @ts-check
|
||||
import eslint from '@eslint/js';
|
||||
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
||||
import globals from 'globals';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
export default tseslint.config(
|
||||
{
|
||||
ignores: ['eslint.config.mjs'],
|
||||
},
|
||||
eslint.configs.recommended,
|
||||
...tseslint.configs.recommendedTypeChecked,
|
||||
eslintPluginPrettierRecommended,
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.node,
|
||||
...globals.jest,
|
||||
},
|
||||
sourceType: 'commonjs',
|
||||
parserOptions: {
|
||||
projectService: true,
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
rules: {
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-floating-promises': 'warn',
|
||||
'@typescript-eslint/no-unsafe-argument': 'warn',
|
||||
"prettier/prettier": ["error", { endOfLine: "auto" }],
|
||||
},
|
||||
},
|
||||
);
|
||||
Reference in New Issue
Block a user