gobin/main.go

42 lines
704 B
Go
Raw Normal View History

2022-12-24 00:34:48 +00:00
package main
import (
"embed"
2022-12-24 00:34:48 +00:00
"log"
"net/http"
2022-12-24 00:34:48 +00:00
"gitea.hackmi.ch/Phil/gobin/routes"
"gitea.hackmi.ch/Phil/gobin/utils"
2022-12-24 00:34:48 +00:00
"github.com/gofiber/fiber/v2"
2023-09-04 18:50:25 +00:00
"github.com/gofiber/template/html/v2"
2022-12-24 00:34:48 +00:00
)
//go:embed views/*
var viewsfs embed.FS
//go:embed assets/*
var publicfs embed.FS
2022-12-24 00:34:48 +00:00
func main() {
utils.Init_ENV()
engine := html.NewFileSystem(http.FS(viewsfs), ".html")
2022-12-24 00:34:48 +00:00
app := fiber.New(fiber.Config{
Views: engine,
ServerHeader: "gobin",
})
utils.ActivateAssets(app, &publicfs)
utils.ActivateLogger(app)
app.Get("/", routes.GetHome)
app.Get("/tos", routes.GetTos)
app.Get("/privacy", routes.GetPrivacy)
app.Get("/imprint", routes.GetImprint)
2022-12-24 00:34:48 +00:00
log.Fatal(app.Listen(":3000"))
}