feat: assetsFS for serving images and media
This commit is contained in:
parent
b134705abc
commit
61fa4fe192
BIN
assets/images/downloads.png
Normal file
BIN
assets/images/downloads.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
@ -7,3 +7,7 @@ var TemplatesFS embed.FS
|
||||
|
||||
//go:embed static/css/*
|
||||
var PublicFS embed.FS
|
||||
|
||||
//go:embed assets/*
|
||||
var AssetsFS embed.FS
|
||||
|
||||
|
3
main.go
3
main.go
@ -113,12 +113,15 @@ func init() {
|
||||
|
||||
log.Println("[ init ] Starting...")
|
||||
templates = template.Must(template.ParseFS(TemplatesFS , "templates/*.html"))
|
||||
log.Println("[ init ] Templates Loaded")
|
||||
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
handler := http.NewServeMux()
|
||||
handler.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(PublicFS))))
|
||||
handler.Handle("/assets/", http.FileServer(http.FS(AssetsFS)))
|
||||
|
||||
handler.HandleFunc(
|
||||
"/download",
|
||||
|
Loading…
Reference in New Issue
Block a user