An open API service indexing awesome lists of open source software.

https://github.com/basemax/go-api-todolist

A Todo List (API) Web-service project designed by Go Language and using MongoDB as a database for storing and managing tasks.
https://github.com/basemax/go-api-todolist

api api-rest go golang mongo mongodb todo-api todo-api-go todo-app todo-list todolist

Last synced: about 1 month ago
JSON representation

A Todo List (API) Web-service project designed by Go Language and using MongoDB as a database for storing and managing tasks.

Awesome Lists containing this project

README

          

# GO API Todo List

A Web service Todo List (API) project designed by Go Language and using MongoDB as a database for storing and managing tasks.

## Tools

- ENV: https://github.com/joho/godotenv
- MUX: https://github.com/gorilla/mux
- Mongo: https://go.mongodb.org/mongo-driver

## API Routes

- **Get a single task**
- Route: `host:8000/api/v1/get/{_id}/`
- Description: replace {_id} with mongodb document id
- Method: GET

- **Get all tasks**
- Route: `host:8000/api/v1/get/`
- Description: return a list of tasks
- Method: GET

- **Insert a new task**
- Route: `host:8000/api/v1/craete/`
- Description: send a JSON request with these fields:
```json
{
"name": "name of task",
"description": "info about task",
"status": true
}
```
- method: POST

- **Delete a task**
- Route: `host:8000/api/v1/delete/{_id}/`
- Description: replace {_id} with desired task id returned in create response
- Method: DELETE

- **Update/Edit a task**
- Route: `host:8000/api/v1/update/{_id}`
- Description: replace {_id} with desired task id and send a JSON in body same as create route.
- Method: PUT

## How to run

You can run this app using 2 methods:

1. **Manual**
1. Clone this repo, rename `env.env` to `.env`, fill fields in `.env` file as desired
2. Run `go build .`
3. Run binary named `./go-api-todolist`

2. **Docker compose**
1. Clone this repo.
2. Run `docker-compose up -d` and wait for app to run on `localhost:8000`

## Authors

- Amir
- Max Base

© Copyright 2022, Max Base