Move init of StaticFS and rename some vars

This commit is contained in:
2022-02-15 12:37:23 +00:00
parent 74a53954de
commit 2f45c415e0
4 changed files with 20 additions and 17 deletions

View File

@ -1,13 +1,17 @@
package main
import (
"io/fs"
"log"
netHttp "net/http"
"git.javil.eu/jacob1123/budgeteer/bcrypt"
"git.javil.eu/jacob1123/budgeteer/config"
"git.javil.eu/jacob1123/budgeteer/http"
"git.javil.eu/jacob1123/budgeteer/jwt"
"git.javil.eu/jacob1123/budgeteer/postgres"
"git.javil.eu/jacob1123/budgeteer/web"
)
func main() {
@ -21,10 +25,16 @@ func main() {
log.Fatalf("Failed connecting to DB: %v", err)
}
static, err := fs.Sub(web.Static, "dist")
if err != nil {
panic("couldn't open static files")
}
h := &http.Handler{
Service: q,
TokenVerifier: &jwt.TokenVerifier{},
CredentialsVerifier: &bcrypt.Verifier{},
StaticFS: netHttp.FS(static),
}
h.Serve()