15 lines
228 B
Go
15 lines
228 B
Go
package routes
|
|
|
|
import (
|
|
"io/fs"
|
|
"net/http"
|
|
)
|
|
|
|
func ServeFiles(fileSystem fs.FS, pathInFs string) http.Handler {
|
|
newFs, err := fs.Sub(fileSystem, pathInFs)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
return http.FileServerFS(newFs)
|
|
}
|