Feature : Create APIs for Coding Problems
Closed this issue · 6 comments
Implement API Routes for Retrieving Problems
Description:
Create API routes to fetch coding problems based on different criteria. Users should be able to get all problems, problems by category, and retrieve a specific problem by ID or title.
Tasks:
-
Get All Problems API:
- Endpoint:
/api/problems
- HTTP Method:
GET
- Request Template:
// No request required for fetching all problems
- Response Template:
[ { "pid": Number, "title": String, "level": String, "companies": [String], // Additional problem details... }, // Additional problems... ]
- Guidelines for Contributor:
- Implement an API endpoint to fetch all coding problems.
- Ensure that the response includes essential details like problem ID, title, level, and associated companies.
- Endpoint:
-
Get Problems by Category API:
- Endpoint:
/api/problems/category/:category
- HTTP Method:
GET
- Request Template:
// No request required for fetching problems by category
- Response Template:
[ { "pid": Number, "title": String, "level": String, "companies": [String], // Additional problem details... }, // Additional problems in the specified category... ]
- Guidelines for Contributor:
- Implement an API endpoint to fetch coding problems based on a specified category.
- Ensure that the response structure is similar to the "Get All Problems" API.
- Endpoint:
-
Get Single Problem API:
- Endpoint:
/api/problems/:idOrTitle
- HTTP Method:
GET
- Request Template:
// No request required for fetching a single problem
- Response Template:
{ "pid": Number, "title": String, "level": String, "companies": [String], // Additional problem details... }
- Guidelines for Contributor:
- Implement an API endpoint to fetch a single coding problem based on either the problem ID or title.
- Ensure that the response includes essential details like problem ID, title, level, and associated companies.
- Endpoint:
Additional Notes:
- Include proper error handling for cases where problems are not found or when there are issues with the database.
- Test the new API routes thoroughly, considering different use cases.
- Update the project's API documentation to include details about the newly added routes.
Reference Links:
Pls assign it to me
@VaibhavGagneja Assigned this to you !
Do write test if you can using Mocha+Chai
@VaibhavGagneja Assigned this to you !
Do write test if you can using Mocha+Chai
Okay thanks
@fallen-ecstasy pls review this, the folder structure, conventions etc https://github.com/VaibhavGagneja/NovaCode-Server/tree/feature/issue-8/create-apis-for-coding-problem
tasks :- apis created , mongoose auto increment changed to mongoose-plugin-autoinc (was causing errors).
Create a PR, then it will much easier to review.
Create a PR, then it will much easier to review.
Created PR pls check