docs handling

This commit is contained in:
2026-02-27 14:47:28 +01:00
parent a795426700
commit f9cb923639
7 changed files with 93 additions and 1 deletions
+4
View File
@@ -12,6 +12,7 @@ type Router struct {
downloadController *DownloadController
playController *PlayController
rootController *RootController
docsController *DocsController
}
func NewRouter(
@@ -20,6 +21,7 @@ func NewRouter(
download_controller *DownloadController,
play_controller *PlayController,
root_controller *RootController,
docs_controller *DocsController,
) *Router {
return &Router{
softwareController: software_controller,
@@ -27,6 +29,7 @@ func NewRouter(
downloadController: download_controller,
playController: play_controller,
rootController: root_controller,
docsController: docs_controller,
}
}
@@ -44,6 +47,7 @@ func (r *Router) Init() *chi.Mux {
router.Get("/download/{name}/{version}/cartridge", r.downloadController.GetCartridge)
router.Get("/play/{name}/{version}", r.playController.Play)
router.Get("/play/{name}/{version}/content*", r.playController.ServeContent)
router.Get("/docs/{name}/{version}/*", r.docsController.ServeDocs)
fs := http.FileServer(http.Dir("assets"))
router.Handle("/assets/*", http.StripPrefix("/assets/", fs))