diff options
author | Samuel Johnson <[email protected]> | 2025-05-04 00:25:10 -0400 |
---|---|---|
committer | Samuel Johnson <[email protected]> | 2025-05-04 00:25:10 -0400 |
commit | 3abe2c3fbe95ab0a38045c359b808fadac6220ea (patch) | |
tree | 6cd22a874eb06fb76c588c8431ed73022b81086f /cmd/web/handlers/routes.go | |
parent | 005a588111e6d27b012bc923c39d97a6129f39f2 (diff) |
Create music player GUI
Diffstat (limited to 'cmd/web/handlers/routes.go')
-rw-r--r-- | cmd/web/handlers/routes.go | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/cmd/web/handlers/routes.go b/cmd/web/handlers/routes.go index 5c927c4..31fe401 100644 --- a/cmd/web/handlers/routes.go +++ b/cmd/web/handlers/routes.go @@ -6,13 +6,27 @@ import ( ) func RegisterEndpoints(app types.Application) *mux.Router { - ctx := blogContext{ + blog := blogContext{ err: app.Err, Name: app.Env.Webmaster, } + audio := fsContext{ + err: app.Err, + path: app.AudioDir, + contentType: "audio/mpeg", + } + static := fsContext{ + err: app.Err, + path: "static", + } blogRouter := mux.NewRouter() - blogRouter.HandleFunc("/", ctx.index) + blogRouter.HandleFunc("/", blog.index) + + blogRouter.HandleFunc("/audio", audio.readdir) + blogRouter.HandleFunc("/audio/get", audio.get) + + blogRouter.HandleFunc("/static/get", static.get) return blogRouter } |