router icon indicating copy to clipboard operation
router copied to clipboard

how to serve files using embed?

Open ahmedRSA opened this issue 2 years ago • 1 comments

i had this code in 'net/http' and we were serving static directory using this code but now we have shifted our code(projects) from net/http to fasthttp and in fasthttp there is no way to serve files from embed

//go:embed static/*
var static embed.FS
fsRoot, _ := fs.Sub(static, "static")
fsStatic := http.FileServer(http.FS(fsRoot))
s.router.PathPrefix("/").Handler(fsStatic)

ahmedRSA avatar Dec 19 '22 10:12 ahmedRSA

i am talking about this embed if some is confuse https://pkg.go.dev/embed

ahmedRSA avatar Dec 19 '22 10:12 ahmedRSA

Fixed in: https://github.com/fasthttp/router/releases/tag/v1.5.0

savsgio avatar May 23 '24 15:05 savsgio