diff options
| author | herkulessi <git@herkulessi.de> | 2025-08-20 20:13:09 +0200 |
|---|---|---|
| committer | herkulessi <git@herkulessi.de> | 2025-08-20 20:13:09 +0200 |
| commit | 32e7fe5f94eee7e08f048d1ead1e7e82f29c46d6 (patch) | |
| tree | bb93bfa26873ad55b51b12398e837bd2ea880b50 /static.go | |
Initial commit of libmkwebpage
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 +} |
