aboutsummaryrefslogtreecommitdiff
path: root/cmd/server
diff options
context:
space:
mode:
authorGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-06-25 16:03:36 +0200
committerGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-06-25 16:12:05 +0200
commitd6cf67b3d7747b6274d92e394d75d348060fa5f5 (patch)
tree8c48f947e7ab732a38b15eab6a898cb14caa1669 /cmd/server
parent57b41ad766b3c4505672c12f058f10c7a132dd5b (diff)
downloadlens-d6cf67b3d7747b6274d92e394d75d348060fa5f5.tar.gz
lens-d6cf67b3d7747b6274d92e394d75d348060fa5f5.tar.bz2
lens-d6cf67b3d7747b6274d92e394d75d348060fa5f5.zip
feat: Add static file to output bin
Now the final binary has a standalone web server including necessary static file.
Diffstat (limited to 'cmd/server')
-rw-r--r--cmd/server/main.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd/server/main.go b/cmd/server/main.go
index 0fa5fea..4ca39de 100644
--- a/cmd/server/main.go
+++ b/cmd/server/main.go
@@ -16,6 +16,7 @@ import (
"gorm.io/driver/sqlite"
"gorm.io/gorm"
+ "git.sr.ht/~gabrielgio/img"
"git.sr.ht/~gabrielgio/img/pkg/components/auth"
"git.sr.ht/~gabrielgio/img/pkg/components/filesystem"
"git.sr.ht/~gabrielgio/img/pkg/components/media"
@@ -69,8 +70,7 @@ func main() {
}
r := router.New()
- r.ServeFiles("/static/{filepath:*}", "./static")
- r.NotFound = ext.NotFoundHTML
+ r.GET("/static/{filepath:*}", ext.FileServer(img.StaticFS, "static/"))
authMiddleware := ext.NewAuthMiddleware(hexKey, logger.WithField("context", "auth"))
logMiddleware := ext.NewLogMiddleare(logger.WithField("context", "http"))