https://github.com/m-yasirghaffar/todolist-rest-api-mern-stack
RESTful backend for todolist apps using MongoDB,Express
https://github.com/m-yasirghaffar/todolist-rest-api-mern-stack
Last synced: 3 months ago
JSON representation
RESTful backend for todolist apps using MongoDB,Express
- Host: GitHub
- URL: https://github.com/m-yasirghaffar/todolist-rest-api-mern-stack
- Owner: M-YasirGhaffar
- Created: 2023-08-27T22:22:48.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-07T23:15:13.000Z (over 1 year ago)
- Last Synced: 2025-03-01T00:31:58.540Z (7 months ago)
- Language: JavaScript
- Homepage: https://todolist-restapi.onrender.com
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ToDoList MERN Backend



This is the backend part of a MERN (MongoDB, Express.js, React.js, Node.js) ToDo List application. It provides the API endpoints required for managing tasks in the ToDo list.
## Getting Started
Follow these steps to set up and run the backend for the ToDo List application:
### Prerequisites
Make sure you have the following software installed on your system:
- [Node.js](https://nodejs.org/) (v14.17.6 or higher)
- [MongoDB](https://www.mongodb.com/) (Community Edition)### Installation
1. Clone the repository:
```bash
git clone https://github.com/M-YasirGhaffar/TodoList-MERN-backend.git
```2. Navigate to the project directory:
```bash
cd TodoList-MERN-backend
```3. Install the required dependencies:
```bash
npm install
```4. Create a `.env` file in the root directory and set the following environment variables:
```
MONGODB_URL=
PORT=
```Replace `` with your MongoDB connection string and `` with the desired port number.
### Usage
1. Start the server:
```bash
npm start
```This will start the Express.js server, and you will see the message "Connected to MongoDB" in the console if the connection is successful.
2. The server will be running at `http://localhost:`.
## API Endpoints
- **GET** `/`: Get a list of all ToDo items.
- **POST** `/save`: Create a new ToDo item.
- Body: `{ "text": "Your task description" }`
- **POST** `/update`: Update an existing ToDo item.
- Body: `{ "_id": "item-id", "text": "Updated task description" }`
- **POST** `/delete`: Delete a ToDo item.
- Body: `{ "_id": "item-id" }`## Contributing
Contributions are welcome! If you find any issues or want to add improvements, feel free to fork this repository and create a pull request.
## License
This project is licensed under the [MIT License](LICENSE).