21 lines
339 B
Go
21 lines
339 B
Go
package main
|
|
|
|
import (
|
|
"embed"
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
//go:embed web
|
|
var webAssets embed.FS
|
|
|
|
func serveHTML(c *gin.Context, name string) {
|
|
content, err := webAssets.ReadFile(name)
|
|
if err != nil {
|
|
c.String(http.StatusNotFound, "not found")
|
|
return
|
|
}
|
|
c.Data(http.StatusOK, "text/html; charset=utf-8", content)
|
|
}
|