Skip to content

GaryJX/golang-api-example

Repository files navigation

Golang API Example by GaryJX

Live example deployed at https://garyjx-golang-api-example.herokuapp.com/api/ (first load may be a bit slow due to cold start)

Local Development Commands

  1. Ensure that you have Golang installed on your machine (This repo uses v1.15.6).
  2. Ensure that you have PostgreSQL installed on your machine. Create 2 empty databases (one for playground and one for running tests).
  3. Clone the repo: git clone https://github.com/GaryJX/golang-api-example.git
  4. Change directory: cd golang-api-example
  5. Configure environment variables for your postgres connection: cp .env.sample .env
  6. Run tests: go test -v
  7. Install go-swagger here or run:
go get -u github.com/go-swagger/go-swagger/cmd/swagger
  1. Re-generate Swagger API docs: swagger generate spec -o ./api/swagger.json
  2. Start server:
go build
./golang-api-example.exe
  1. View API at http://localhost:8080/api/

Resources

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published