Gorsk is a Golang starter kit for developing RESTful services. It is designed to help you kickstart your project, skipping the 'setting-up part' and jumping straight to writing business logic.
gorm
as the ORM
gorm
doesn't have the limitations indicated by the author of gorskgorm
allows for use of various different DB'sthird_party/swaggerui/spec
/assets
to /third_party/swaggerui/dist
PACKAGE | LICENSE |
---|---|
Golang | |
github.com/labstack/echo | MIT |
github.com/jinzhu/gorm | MIT |
github.com/dgrijalva/jwt-go | MIT |
github.com/rs/zerolog | MIT |
github.com/go-playground/validator | MIT |
github.com/nbutton23/zxcvbn-go | MIT |
github.com/stretchr/testify | MIT |
github.com/go-yaml/yaml | Apache |
node.js | |
npmjs.com/package/multi-file-swagger | MIT |
Started with the project structure from gorsk
trying to maintain golang-standards for project layout
ensure that you have properly setup dependencies
$ make deps
use make to help with development
just run make help to see all the automated support with make
$ make help
run make setup
then after that, make serve
to use swagger to test endpoints.
or use curl
to login with bootstrap data
$ curl -X POST "http://localhost:8080/login" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d "{ \"password\": \"admin\", \"username\": \"admin\"}"
Visit http://localhost:8080/swaggerui/
(with trailing slash) in your browser to test out some endpoints!
make TYPE=yaml swagger
or multi-file-swagger to generate the swagger .yaml
spec file.full_spec.yaml
as an update from theThe application runs as an HTTP server at port 8080. It provides the following RESTful endpoints:
POST /login
: accepts username/passwords and returns jwt token and refresh token
GET /refresh/:token
: refreshes sessions and returns jwt token
GET /me
: returns info about currently logged in user
GET /swaggerui/
(with trailing slash): launches swaggerui in browser
GET /v1/users
: returns list of users
GET /v1/users/:id
: returns single user
POST /v1/users
: creates a new user
PATCH /v1/password/:id
: changes password for a user
DELETE /v1/users/:id
: deletes a user
You can log in as admin to the application by sending a post request to localhost:8080/login with username admin
and password admin
in JSON body.
When sending the Authorization header use this format: Authorization: Bearer TOKEN_HASH
Currently licensed under MIT, check the LICENSE file for details.