32 lines
614 B
Go
32 lines
614 B
Go
|
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)
|
||
|
}
|
||
|
}
|