html-bypass/main.go

32 lines
614 B
Go
Raw Permalink Normal View History

2023-09-13 15:12:44 +02:00
package main
import (
"embed"
"git.jmbit.de/html-bypass/web"
"github.com/gin-gonic/gin"
"html/template"
"log"
"net/http"
)
//go:embed assets/*
var assetsFS embed.FS
//go:embed templates/*.gohtml
var templatesFS embed.FS
func main() {
router := gin.Default()
templates := template.Must(template.New("").ParseFS(templatesFS, "templates/*.gohtml"))
router.ForwardedByClientIP = true
router.SetHTMLTemplate(templates)
router.StaticFS("/static", http.FS(assetsFS))
router.GET("/", web.Index)
router.GET("/download/:fileType/", DownloadFile)
err := router.Run()
if err != nil {
log.Fatal(err)
}
}