A backend for TodoMVC implemented with Go using no external dependencies
Build the docker image with:
DOCKER_BUILDKIT=1 docker build -t todo-backend-golang .
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
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
...
[]
curl -X POST -H 'Content-Type: application/json' \
-d '{"title":"Foo"}' http://todomvc.go:8080/todos/
curl -X PATCH -H 'Content-Type: application/json' \
-d '{"title":"Foo","completed":true}' http://todomvc.go:8080/todos/1
curl -X DELETE http://todomvc.go:8080/todos/1