No description
|
||
---|---|---|
database/migrations | ||
pkg | ||
static | ||
templates | ||
vendor | ||
.air.toml | ||
.drone.yml | ||
.gitignore | ||
docker-compose.yml | ||
Dockerfile | ||
go.mod | ||
go.sum | ||
main.go | ||
Makefile | ||
readme.md |
Sample Webapplication in Go
Sample Webapplication in go, create a kind of skeleton for monolith webapplicaion. Useed to create a small MVP Project.
Structur
Create (self contained) pkg for a group of pages. The pkg included the View and Go files for the Pages e.g. user pages.
Including Packages
- https://github.com/go-chi/chi -> Routing and middelware
- https://github.com/go-chi/jwtauth -> For JWT Auth
- https://github.com/golang-migrate/migrate -> for mysql migration
- https://github.com/urfave/cli -> for cli commands like migration
- https://github.com/unrolled/render -> render json and html
Features
Global Layout
The "globale layout" is put arround each response from a pkg web response. It read the response buffer from and use the content to parse the layout.tmpl. It works via middelware
JWT-Auth
todo
Migrations
Its possitlbe to execute the migrations via go run ./ migrate
. It execute the migration files in database/migrations/*.sql
One Binary
Everything (include templaes and migration) can be added in one binary
Make commands
- build -> Build webapp
- init-dev -> Start docker copose
- run-dev -> Run Webapp with reload if someting is change (air)
Docker Image
https://hub.docker.com/r/kekskurse/go-sample-webpage
Next Steps
- conifg per env
- argument config?
- make nice user register and login page