diff options
Diffstat (limited to 'web/web.go')
| -rw-r--r-- | web/web.go | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -30,6 +30,7 @@ var gzPool = sync.Pool{ var ( staticBox *rice.Box frontendBox *rice.Box + vanillaBox *rice.Box ) func init() { @@ -43,6 +44,11 @@ func init() { if err != nil { log.Printf("Warning: Could not find frontendBox at ../frontend/dist: %v", err) } + + vanillaBox, err = rice.FindBox("../vanilla") + if err != nil { + log.Printf("Warning: Could not find vanillaBox at ../vanilla: %v", err) + } } func indexHandler(w http.ResponseWriter, r *http.Request) { @@ -236,6 +242,11 @@ func NewRouter() http.Handler { apiRouter := api.NewRouter() mux.Handle("/api/", GzipMiddleware(http.StripPrefix("/api", AuthWrapHandler(apiRouter)))) + // Vanilla JS Prototype + if vanillaBox != nil { + mux.Handle("/vanilla/", GzipMiddleware(http.StripPrefix("/vanilla/", http.FileServer(vanillaBox.HTTPBox())))) + } + // Legacy routes for backward compatibility mux.HandleFunc("/stream/", AuthWrap(api.HandleStream)) mux.HandleFunc("/item/", AuthWrap(api.HandleItem)) |
