Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/krish-r/go-todo-demo
https://github.com/krish-r/go-todo-demo
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/krish-r/go-todo-demo
- Owner: krish-r
- License: mit
- Created: 2022-12-26T17:05:11.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-19T05:28:24.000Z (about 1 year ago)
- Last Synced: 2024-06-21T00:10:02.193Z (7 months ago)
- Language: Go
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Todo Demo
A feature-incomplete, not-so-perfect, not-blazingly-fast and not-production-ready todo api I wrote while exploring some of the features in Go :laughing:
## Running the app
- With in-memory storage (`map[int]string` :smile:)
```sh
go run .
```- With MongoDB docker container (refer `docker-compose.yaml`)
```sh
docker compose upgo run . -m true
```(Note: use `Ctrl+C` to stop the app. And, if docker container was used, run `docker compose down` to stop the container)
## APIs
- **Note**:
- `localhost:3000` is used as the host & port in the examples)
- `jq` is used in the examples to pretty-print json response
- use a trailing slash when sending the request using curl i.e. `/todo/`- **Add** a Todo
```sh
curl -X POST localhost:3000/todo/ \
-H 'Content-Type: application/json' \
-d '{ "description": "test_description", "due": "9999-12-01 11:59:59PM" }' | jq .
```- **Delete** a Todo
```sh
curl localhost:3000 | jq .
```- **Get** a Todo
```sh
curl localhost:3000/todo/1 | jq .
```- **Get All** Todos
```sh
curl localhost:3000/todo/ | jq .
```