Go Seed
A seed project for Restful Web APIs
Built with Golang and Gin
Gopher Images by Renée French is licensed under Creative Commons Attributions
Proposal
This repository is a seed for API projects developed in Go. It contains the dependencies, basic structure, test scripts and coverage. It is possible to easily integrate it with other services like Travis Ci, Heroku and Coveralls.
Use from the source
Assuming a recent version installed of Go and the variables GOROOT
and GOPATH
already defined, the set of commands below should recreate this project locally on a machine. Otherwise, this installation guide available in official of the Golang site will help.
In addition, to manage possible dependencies this project use a vendor folder. Is possible restore dependencies using govendor whose installation instructions are available here or Godep whose installations instructions are available here.
Using govendor the following instructions should work fine, otherwise check the dependency manager documentation.
On Windows
> go get -u github.com/crissilvaeng/goseed
> cd %GOPATH%\github.com\crissilvaeng\goseed
> govendor sync
> go get
> goseed
On Linux
$ go get -u github.com/crissilvaeng/goseed
$ cd $GOPATH/github.com/crissilvaeng/goseed
$ govendor sync
$ go get
$ goseed
To test, run this command PORT=5000 go run main.go
.
Then check the results with curl -i http://localhost:5000/v1/hello
. If all went well, the following results should be obtained:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Sun, 02 Oct 2016 07:46:36 GMT
Content-Length: 69
{"message":"The answer to life, the universe and everything is 42."}
CI and Deploy
This solution is designed to use the following services: Travis CI, Coveralls and Heroku.
Coveralls
Connect this repository to a account in Coveralls](https://coveralls.io/) service. Save the repo_token
. Replace the URL of the README badge.
Travis CI
Connect this repository to a account in Travis CI service. Set two environment variables. One called COVERALLS_TOKEN
whit the repo_token
from Coveralls. The second called CI_SERVICE
with the name of the service.
Heroku
Create a new app. Next, in deploy option connect with Github and configure to deploy this repository after build on Travis CI.
Change Log
To see the changes in this project, see the change log file.
Contribution
To contribute to this project, see the file contribution tips and code of conduct.
License
The MIT License (MIT). To see the details of this license, see the license file.