1 2 3 4 5 6 7 8 9 10 11 12 13 14
package libmkwebpage import ( "embed" "io/fs" "net/http" ) func (w *Webpage) NewStaticFiles(pattern string, static embed.FS, dynamic fs.FS) *Webpage { w.HandlerDynamic("GET "+pattern, http.FileServerFS(dynamic)) w.HandlerStatic("GET "+pattern, http.FileServerFS(static)) w.staticFilePrefix = pattern return w }