https://github.com/divyansh956/todoapp-backend
A simple TodoApp built with Express.js and MongoDB, providing basic CRUD operations (Create, Read, Update, Delete) for managing tasks.
https://github.com/divyansh956/todoapp-backend
expressjs mongodb postman reactjs
Last synced: 3 months ago
JSON representation
A simple TodoApp built with Express.js and MongoDB, providing basic CRUD operations (Create, Read, Update, Delete) for managing tasks.
- Host: GitHub
- URL: https://github.com/divyansh956/todoapp-backend
- Owner: divyansh956
- License: mit
- Created: 2023-11-04T15:27:40.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-06T13:41:06.000Z (over 2 years ago)
- Last Synced: 2025-01-10T15:47:57.328Z (over 1 year ago)
- Topics: expressjs, mongodb, postman, reactjs
- Language: JavaScript
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TodoApp with Express.js and MongoDB
A simple TodoApp built with Express.js and MongoDB, providing basic CRUD operations (Create, Read, Update, Delete) for managing tasks.
## Prerequisites
Make sure you have the following installed:
- [Node.js](https://nodejs.org/)
- [MongoDB](https://www.mongodb.com/)
## Getting Started
1. **Clone the repository**
```bash
git clone
cd TodoApp-Express-MongoDB
```
2. **Install Dependencies**
```bash
npm install
```
3. **Configure MongoDB**
- Make sure your MongoDB server is up and running.
- Update the MongoDB connection URL in `config.js` file if necessary.
4. **Start the Application**
```bash
npm start
```
The app will be running at `http://localhost:3000`.
## API Endpoints
### 1. **Get All Todos:**
- **Method:** GET
- **URL:** `http://localhost:3000/ap1/v1/getTodos`
### 2. **Get Todo by ID:**
- **Method:** GET
- **URL:** `http://localhost:3000/ap1/v1/getTodos:id`
### 3. **Create Todo:**
- **Method:** POST
- **URL:** `http://localhost:3000/ap1/v1/createTodo`
- **Body:**
```json
{
"title": "New Todo",
"description": "Todo Description"
}
```
- **Headers:**
- `Content-Type: application/json`
### 4. **Update Todo:**
- **Method:** PUT
- **URL:** `http://localhost:3000/api/v1/updateTodo/:id`
- **Body:**
```json
{
"title": "Updated Todo",
"description": "Updated Description"
}
```
- **Headers:**
- `Content-Type: application/json`
### 5. **Delete Todo:**
- **Method:** DELETE
- **URL:** `http://localhost:3000/api/v1/deleteTodo/:id`
In Postman, you can select the appropriate HTTP method from the dropdown menu, enter the URL, set the request body and headers accordingly, and then click "Send" to make the request.
## Technologies Used
- **Express.js:** Web framework for Node.js.
- **MongoDB:** NoSQL database for storing todo data.
- **Mongoose:** MongoDB object modeling for Node.js.
- **Body-parser:** Node.js body parsing middleware.
- **Nodemon:** Development utility that automatically restarts the server.
- **dotenv:** Loads environment variables from a `.env` file.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.