This is a TypeScript-based Node.js service for managing employee records. It provides a RESTful API for basic CRUD operations on employee data.
- Create, Read, Update, and Delete employee records
- RESTful API
- TypeScript for type safety
- Jest for unit and integration testing
- Docker support for easy deployment
- Node.js (v14 or later)
- npm (v6 or later)
- Docker (optional, for containerization)
-
Clone the repository: git clone https://github.com/your-username/employee-management-service.git cd employee-management-service
-
Install dependencies: npm install
To run the application in development mode with hot-reloading: npm run dev
The server will start on http://localhost:3000
.
To run the application in production mode:
-
Build the TypeScript code: npm run build
-
Start the server: npm start
GET /api/employees
: Get all employeesGET /api/employees/:id
: Get an employee by IDPOST /api/employees
: Create a new employeePUT /api/employees/:id
: Update an employeeDELETE /api/employees/:id
: Delete an employee
To run the test suite: npm test
For watching mode (reruns all tests on file changes): npm run test:watchAll
To generate a coverage report: npm run test:coverage
To build and run the application using Docker:
-
Build the Docker image: docker build -t employee-management-service .
-
Run the container: docker run -p 3000:3000 employee-management-service
he service will be available at http://localhost:3000
.
PORT
: The port number on which the server will run (default: 3000)NODE_ENV
: The environment in which the application is running (e.g., 'development', 'production')