-
Dependencies:
- Added
express,swagger-jsdoc, andswagger-ui-expressfor API routing and Swagger UI generation. - Added
prom-clientfor Prometheus metrics collection. - Added
dotenvfor environment variable management. - Added
corsandbody-parserfor middleware. - Added
reflect-metadatafor future extensibility.
- Added
-
Dev Dependencies:
- Included TypeScript types for Express, Node.js,
body-parser, andcors. - Added
eslintand@typescript-eslintplugins for linting TypeScript files. - Added
jestandts-jestfor unit testing.
- Included TypeScript types for Express, Node.js,
-
Scripts:
start: Runs the app in development mode withts-node-dev.build: Compiles the app to JavaScript and cleans up thedistdirectory.start:prod: Starts the compiled production app.test: Runs Jest in watch mode.lint: Runs ESLint for code quality checks.prettierandprettier:fix: Runs Prettier to ensure consistent formatting.swagger:generate: Generates Swagger JSON documentation from JSDoc comments in the code.
-
Install Dependencies:
npm install
-
Start in Development Mode:
npm run start
-
Build for Production:
npm run build
-
Run in Production Mode:
npm run start:prod
-
Generate Swagger Documentation:
npm run swagger:generate
-
Lint and Format Code:
npm run lint npm run prettier
-
Run Tests:
npm run test -
Visit Swagger:
http://localhost:4400/swagger ```# demo-node-api