Skip to content

tullo/todo-backend-golang

 
 

Repository files navigation

todo-backend-golang

A backend for TodoMVC implemented with Go using no external dependencies

Build Docker Image

Build the docker image with:

DOCKER_BUILDKIT=1 docker build -t todo-backend-golang .

Run Docker Container

Run the docker container with:

docker run --hostname todomvc.go -p 8080:8080 todo-backend-golang

Or use the pre-built image form DockerHub

docker run --hostname todomvc.go -p 8080:8080 tullo/todo-backend-golang

$ cat /etc/hosts
...
127.0.1.1       todomvc.go
192.168.0.126   todomvc.vue

CRUD Tests

Read (GET) response

curl -v http://todomvc.go:8080/todos

< HTTP/1.1 200 OK
< Access-Control-Allow-Methods: OPTIONS, GET, POST, PATCH, DELETE
< Content-Type: application/json; charset=UTF-8
...
[]

Create (POST)

curl -X POST -H 'Content-Type: application/json' \
    -d '{"title":"Foo"}' http://todomvc.go:8080/todos/

Update (PATCH)

curl -X PATCH -H 'Content-Type: application/json' \
    -d '{"title":"Foo","completed":true}' http://todomvc.go:8080/todos/1

Delete (DELETE)

curl -X DELETE http://todomvc.go:8080/todos/1

About

A backend for TodoMVC implemented with Go (stdlib only)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 96.2%
  • Dockerfile 3.8%