go-sample-webpage/main.go
kekskurse 2d39757d71
Some checks failed
continuous-integration/drone/push Build is failing
Refactory and mail
2021-11-22 23:11:37 +01:00

34 lines
790 B
Go

package main
import (
"embed"
"git.keks.cloud/kekskurse/go-sample-webpage/pkg/sample"
"git.keks.cloud/kekskurse/go-sample-webpage/pkg/user"
"git.keks.cloud/kekskurse/go-sample-webpage/pkg/webpage"
"github.com/go-chi/chi/v5"
"github.com/go-chi/jwtauth/v5"
)
// content holds our static web server content.
//go:embed static/* templates/*
var webserver embed.FS
//go:embed database/migrations/*.sql
var migrationFS embed.FS
func main() {
config := webpage.WebPageConfig{
Templates: webserver,
Static: webserver,
Migrations: migrationFS,
Bootstrap: func(router chi.Router) {
tokenAuth := jwtauth.New("HS256", []byte("secret"), nil)
uc := user.GetUserClient()
sample.Register(router)
user.Register(router, tokenAuth, uc)
},
}
webpage.RunWebApp(config)
}