diff options
Diffstat (limited to 'static.go')
| -rw-r--r-- | static.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/static.go b/static.go new file mode 100644 index 0000000..04c0fe6 --- /dev/null +++ b/static.go @@ -0,0 +1,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 +} |
