34 lines
790 B
Go
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)
|
|
}
|