Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ProblemService API

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.

Table of Contents

  1. Features
  2. Prerequisites
  3. Installation
  4. Configuration
  5. Running the Application
  6. API Endpoints
  7. Testing
  8. Error Handling
  9. Contributing
  10. License

Features

  • Create new coding problems
  • Retrieve a list of all problems
  • Retrieve a specific problem by ID
  • Update existing problems
  • Delete problems
  • Health check endpoint

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/problem-service.git
    cd problem-service
  2. Install dependencies:

    npm install

Configuration

  1. Create a .env file in the root directory with the following content:

    PORT=3000
    MONGODB_URI=mongodb://localhost:27017/problem_service
    NODE_ENV=development
  2. Adjust the values as needed for your environment.

Running the Application

To start the server in development mode:

npm run dev

For production:

npm start

The server will start running on http://localhost:3000 (or the port specified in your .env file).

API Endpoints

All endpoints are prefixed with /api/v1.

  • GET /api/v1/problem/health: Health check
  • POST /api/v1/problem: Create a new problem
  • GET /api/v1/problem: Retrieve all problems
  • GET /api/v1/problem/:id: Retrieve a specific problem by ID
  • PATCH /api/v1/problem/:id: Update a problem
  • DELETE /api/v1/problem/:id: Delete a problem

For detailed API documentation, refer to the API Documentation file.

Testing

To run tests:

npm test

Error Handling

The API uses custom error classes and a centralized error handling middleware. Refer to the errors/ directory for more information on specific error types.

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License. See the LICENSE.md file for details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages