Skip to content

andream16/Go-Todo-List

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go-Todo-List

A simple RESTful application built with go, gorilla/mux and go-redis.

What you need to run it

  • 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

How to run it

  • Start redis daemon sudo service start redis or sudo systemctl start redis
  • run the main using go run main/main.go or build the project with go build and run it's bin

What you can Actually do

  • 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.

Tests?

Sure thing. Run tests using go test./... to run all the tests in each folder. A test comes like nameOfTheTest_test.go.