go-todo-demo

command module
v0.0.0-...-12f8c36 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 14 Imported by: 0

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 😆

Running the app

  • With in-memory storage (map[int]string 😄)

    go run .
    
  • With MongoDB docker container (refer docker-compose.yaml)

    docker compose up
    
    go 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

    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

    curl localhost:3000 | jq .
    
  • Get a Todo

    curl localhost:3000/todo/1 | jq .
    
  • Get All Todos

    curl localhost:3000/todo/ | jq .
    

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL