A simple RESTful application built with go, gorilla/mux and go-redis.
- go1.8
- redis3.1
- gorilla/mux. You can get it using
go get -u github.com/gorilla/mux
inside your$GOPATH
- go-redis. You can get it using
go get -u github.com/go-redis/redis
- Start redis daemon
sudo service start redis
orsudo systemctl start redis
- run the main using
go run main/main.go
or build the project withgo build
and run it's bin
- Get all todos :
curl -H "Content-Type: application/json" -X GET http://localhost:8000
- Get one todo :
curl -H "Content-Type: application/json" -X GET -d '{"id":"1"}' http://localhost:8000
- Add a new todo:
curl -H "Content-Type: application/json" -X POST -d '{"content":"Have some Nugs"}' http://localhost:8000
- Edit a todo :
curl -H "Content-Type: application/json" -X PUT -d '{"id":"1", "content":"New Content"}' http://localhost:8000
- Delete a todo :
curl -H "Content-Type: application/json" -X DELETE -d '{"id":"1"}' http://localhost:8000
Swagger reference available here.
Sure thing. Run tests using go test./...
to run all the tests in each folder. A test comes like nameOfTheTest_test.go
.