jameshtwose / rest-to-go

A REST API written in golang with swagger documentation included.

Home Page:https://rest-to-go-api.onrender.com/swagger/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rest-to-go

A REST API written in golang with swagger documentation included.

Usefull commands

  • go run . - run the application
  • go build . - build the application (creates an executable)
  • go get . - get all dependencies
  • go mod init rest-to-go-api - create a new module
  • curl http://localhost:8080/albums - get all albums
  • go install github.com/swaggo/swag/cmd/swag@latest - install swag (for swagger documentation)
    • export PATH=$(go env GOPATH)/bin:$PATH - add go bin to path (for swag if not working)
  • go get -u github.com/swaggo/gin-swagger - install gin-swagger
  • go get -u github.com/swaggo/files - install files (for swagger)
  • swag init - generate swagger documentation (run this in the root of the project each time to update the documentation)
  • docker build -t rest-to-go-api . - build docker image
  • docker run -p 8080:8080 rest-to-go-api - run docker image

About

A REST API written in golang with swagger documentation included.

https://rest-to-go-api.onrender.com/swagger/index.html


Languages

Language:Go 94.2%Language:Dockerfile 5.8%