This project implements a RESTful API for managing tasks using Node.js, Express, and MongoDB with Mongoose.
- CRUD Operations: Allows creating, reading, updating, and deleting tasks.
- MongoDB Integration: Uses Mongoose to interact with a MongoDB database.
- Error Handling: Implements basic error handling for database operations.
- Middleware: Includes
body-parser
for parsing JSON andcors
for handling Cross-Origin Resource Sharing. - Routing: Defines routes for
/api/tasks
to manage tasks.
Before running the application, make sure you have the following installed:
- Node.js
- MongoDB
-
Clone the repository:
git clone https://github.com/AvinashAnand02/PedalStart.git cd PedalStart
-
Install dependencies:
npm install
-
Set up MongoDB:
- Make sure MongoDB is running on
localhost:27017
or update the connection string inapp.js
.
-
Start the server:
npm start
The server will start running on http://localhost:3001.
- URL:
/api/tasks
- Method:
GET
- Response: Retrieves all tasks stored in the database.
- URL:
/api/tasks/:id
- Method:
GET
- Response: Retrieves a single task by its ID.
- URL:
/api/tasks
- Method:
POST
- Request Body: JSON object with
title
,description
, anddueDate
fields. - Response: Creates a new task and returns the created task object.
- URL:
/api/tasks/:id
- Method:
PUT
- Request Body: JSON object with updated
title
,description
, anddueDate
fields. - Response: Updates an existing task and returns the updated task object.
- URL:
/api/tasks/:id
- Method:
DELETE
- Response: Deletes a task by its ID and returns a success message.
This project is licensed under the MIT License - see the LICENSE file for details.
Design inspired by Avinash Anand.
This Task Management Application was developed solely by me for the first round of the full-stack developer job role at PedalStart. Special thanks to PedalStart for providing the opportunity to showcase skills and abilities in this assignment.