2022-12-24 00:34:48 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2023-01-04 01:56:31 +00:00
|
|
|
"embed"
|
2022-12-24 00:34:48 +00:00
|
|
|
"log"
|
2023-01-04 01:56:31 +00:00
|
|
|
"net/http"
|
2022-12-24 00:34:48 +00:00
|
|
|
|
2023-01-04 01:56:31 +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
|
|
|
)
|
|
|
|
|
2023-01-04 01:56:31 +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() {
|
|
|
|
|
2023-01-04 01:56:31 +00:00
|
|
|
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",
|
|
|
|
})
|
|
|
|
|
2023-01-04 01:56:31 +00:00
|
|
|
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"))
|
|
|
|
}
|