Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/p-e-g-a-h/todoapp_mongoose_api
Simple CRUD API For Todo App
https://github.com/p-e-g-a-h/todoapp_mongoose_api
express javascript mocha mongodb mongoose nodejs nodemon supertest
Last synced: 9 days ago
JSON representation
Simple CRUD API For Todo App
- Host: GitHub
- URL: https://github.com/p-e-g-a-h/todoapp_mongoose_api
- Owner: p-e-g-a-h
- Created: 2024-01-31T11:30:04.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-02-01T12:10:21.000Z (10 months ago)
- Last Synced: 2024-10-11T22:41:23.834Z (about 1 month ago)
- Topics: express, javascript, mocha, mongodb, mongoose, nodejs, nodemon, supertest
- Language: JavaScript
- Homepage: https://todoapp-mongoose-api.onrender.com/
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Todo App mongoose API
### Installation
1. Clone repository:
```
git clone https://github.com/p-e-g-a-h/todoapp_mongoose_api.git
```
2. Navigate to project directory:
```
cd todoapp_mongoose_api
```
3. Install dependencies:
```
npm install
```
4. Configure your MongoDB connection by updating server/config/config.js file.5. Start server:
```
npm run dev
```### API Routes
#### Create Todo and Get All Todos
* URL: `/api/todos`
* Method: `GET`, `POST`
* Request Body (POST):
```
{
"text": "Your todo text here"
}
```
* Response (POST):
```
{
"_id": "todoId",
"text": "Your todo text here",
"completed": false,
"completedAt": null
}
```
* Response (GET):
```
[
{
"_id": "todoId",
"text": "Todo 1",
"completed": false,
"completedAt": null
},
{
"_id": "todoId",
"text": "Todo 2",
"completed": false,
"completedAt": null
},
// ...
]
```
#### Get, Update, or Delete Todo by ID
* URL: `/api/todos/:id`
* Method: `GET`, `PATCH`, `DELETE`
* Request Body (PATCH):
```
{
"text": "update todo text",
"completed": true,
}
```
* Response (PATCH):
```
{
// old todo
"_id": "todoId",
"text": "Todo text",
"completed": false,
"completedAt": null
}
```
* Response (GET/DELETE):
```
{
"_id": "todoId",
"text": "Todo text",
"completed": false,
"completedAt": null
}
```