🎇 add public folder router

pull/548/head
Xhofe 2021-12-25 17:07:59 +08:00
parent 36f07ee194
commit 958d793725
1 changed files with 5 additions and 0 deletions

View File

@ -32,7 +32,12 @@ func Static(r *gin.Engine) {
if err != nil {
log.Fatalf("can't find assets folder")
}
pub, err := fs.Sub(public.Public, "public")
if err != nil {
log.Fatalf("can't find public folder")
}
r.StaticFS("/assets/", http.FS(assets))
r.StaticFS("/public/", http.FS(pub))
r.NoRoute(func(c *gin.Context) {
c.Status(200)
c.Header("Content-Type", "text/html")