aboutsummaryrefslogtreecommitdiff
path: root/pkg/handler/static.go
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-05-26 00:05:31 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-05-26 14:41:21 +0200
commit349a3d1ff36a436261b1b65b870f8f262f06584f (patch)
tree25c4d6933c49f818e520ce662ffa15e040877f4d /pkg/handler/static.go
parentc06945c189c1d8ef3cedeb51e416ba0fec36368f (diff)
downloadcerrado-349a3d1ff36a436261b1b65b870f8f262f06584f.tar.gz
cerrado-349a3d1ff36a436261b1b65b870f8f262f06584f.tar.bz2
cerrado-349a3d1ff36a436261b1b65b870f8f262f06584f.zip
feat: Add bare bones project list
Diffstat (limited to 'pkg/handler/static.go')
-rw-r--r--pkg/handler/static.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/pkg/handler/static.go b/pkg/handler/static.go
new file mode 100644
index 0000000..9f312f4
--- /dev/null
+++ b/pkg/handler/static.go
@@ -0,0 +1,18 @@
+package handler
+
+import (
+ "io/fs"
+ "net/http"
+
+ "git.gabrielgio.me/cerrado/static"
+)
+
+func NewStaticHander(prefix string) (http.Handler, error) {
+ staticFs, err := fs.Sub(static.Static, ".")
+ if err != nil {
+ return nil, err
+ }
+
+ handler := http.StripPrefix(prefix, http.FileServer(http.FS(staticFs)))
+ return handler, nil
+}