package routes import "net/http" type UIHandlers struct { Home http.HandlerFunc NewPage http.HandlerFunc SemanticEditor http.HandlerFunc SemanticPage http.HandlerFunc RawView http.HandlerFunc LinkManager http.HandlerFunc Health http.HandlerFunc Tree http.HandlerFunc Config http.HandlerFunc } func RegisterUIRoutes( mux *http.ServeMux, h UIHandlers, ) { mux.HandleFunc( "/healthz", h.Health, ) mux.HandleFunc( "/v/tree", h.Tree, ) mux.HandleFunc( "/-/sys/config", h.Config, ) mux.HandleFunc( "/new", h.NewPage, ) mux.HandleFunc( "/e", h.SemanticEditor, ) mux.HandleFunc( "/e/", h.SemanticEditor, ) mux.HandleFunc( "/raw", h.RawView, ) mux.HandleFunc( "/raw/", h.RawView, ) mux.HandleFunc( "/l/", h.LinkManager, ) mux.HandleFunc( "/", func( w http.ResponseWriter, r *http.Request, ) { if r.URL.Path == "/" { h.Home( w, r, ) return } switch r.URL.Path { case "/v/tree": h.Tree( w, r, ) return case "/new": h.NewPage( w, r, ) return } if r.URL.Path == "/e" || r.URL.Path == "/raw" { http.NotFound( w, r, ) return } h.SemanticPage( w, r, ) }, ) }