command
module
Version:
v0.0.0-...-57595c4
Opens a new window with list of versions in this module.
Published: Jan 18, 2021
License: MIT
Opens a new window with license information.
Imports: 10
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
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
- Ensure that you have Golang installed on your machine (This repo uses v1.15.6).
- Ensure that you have PostgreSQL installed on your machine. Create 2 empty databases (one for playground and one for running tests).
- Clone the repo:
git clone https://github.com/GaryJX/golang-api-example.git
- Change directory:
cd golang-api-example
- Configure environment variables for your postgres connection:
cp .env.sample .env
- Run tests:
go test -v
- Install
go-swagger
here or run:
go get -u github.com/go-swagger/go-swagger/cmd/swagger
- Re-generate Swagger API docs:
swagger generate spec -o ./api/swagger.json
- Start server:
go build
./golang-api-example.exe
- View API at http://localhost:8080/api/
Resources
Documentation
¶
Golang Example API
Example Description ¶
Terms Of Service:
BasePath: /api
Version: 1.0.0
Consumes:
- application/json
Produces:
- application/json
swagger:meta
Source Files
¶
Click to show internal directories.
Click to hide internal directories.