This project is following the tutorials of Pragmatic Reviews' Golang Crash Course.
-
More about Gorilla Mux toolkit here.
-
To use a firebase db do not forget to export the credentials like this:
export GOOGLE_APPLICATION_CREDENTIALS="/home/user/firebase/credentials.json"
- For the GET and POST operations with curl use:
# GET operation
curl localhost:8000/posts
# POST operation
curl -d '{"title":"Title 1", "text":"This book is about ..."}' -H "Content-Type: application/json" -X POST http://localhost:8000/posts
- To run Unit Testing
go test golang-rest-api/service -v