ProblemService is a RESTful API for managing coding problems. It provides endpoints for creating, reading, updating, and deleting problem entries, as well as a health check endpoint.
- Features
- Prerequisites
- Installation
- Configuration
- Running the Application
- API Endpoints
- Testing
- Error Handling
- Contributing
- License
- Create new coding problems
- Retrieve a list of all problems
- Retrieve a specific problem by ID
- Update existing problems
- Delete problems
- Health check endpoint
-
Clone the repository:
git clone https://github.com/yourusername/problem-service.git cd problem-service -
Install dependencies:
npm install
-
Create a
.envfile in the root directory with the following content:PORT=3000 MONGODB_URI=mongodb://localhost:27017/problem_service NODE_ENV=development
-
Adjust the values as needed for your environment.
To start the server in development mode:
npm run devFor production:
npm startThe server will start running on http://localhost:3000 (or the port specified in your .env file).
All endpoints are prefixed with /api/v1.
GET /api/v1/problem/health: Health checkPOST /api/v1/problem: Create a new problemGET /api/v1/problem: Retrieve all problemsGET /api/v1/problem/:id: Retrieve a specific problem by IDPATCH /api/v1/problem/:id: Update a problemDELETE /api/v1/problem/:id: Delete a problem
For detailed API documentation, refer to the API Documentation file.
To run tests:
npm testThe API uses custom error classes and a centralized error handling middleware. Refer to the errors/ directory for more information on specific error types.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License. See the LICENSE.md file for details.