-
Dependencies:
- Added
express
,swagger-jsdoc
, andswagger-ui-express
for API routing and Swagger UI generation. - Added
prom-client
for Prometheus metrics collection. - Added
dotenv
for environment variable management. - Added
cors
andbody-parser
for middleware. - Added
reflect-metadata
for future extensibility.
- Added
-
Dev Dependencies:
- Included TypeScript types for Express, Node.js,
body-parser
, andcors
. - Added
eslint
and@typescript-eslint
plugins for linting TypeScript files. - Added
jest
andts-jest
for 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 thedist
directory.start:prod
: Starts the compiled production app.test
: Runs Jest in watch mode.lint
: Runs ESLint for code quality checks.prettier
andprettier: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