fix silly admin routing nonsense
This commit is contained in:
parent
09c09b6310
commit
a33e6717e0
6 changed files with 57 additions and 58 deletions
|
|
@ -9,17 +9,23 @@ func Handler(app *model.AppState) http.Handler {
|
|||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
mux := http.NewServeMux()
|
||||
|
||||
mux.Handle("/releases/", http.StripPrefix("/releases", serveReleases(app)))
|
||||
mux.HandleFunc("/music/releases/{id}/", func(w http.ResponseWriter, r *http.Request) {
|
||||
serveEditRelease(app, r.PathValue("id")).ServeHTTP(w, r)
|
||||
})
|
||||
mux.HandleFunc("/music/releases/{id}", func(w http.ResponseWriter, r *http.Request) {
|
||||
serveRelease(app, r.PathValue("id")).ServeHTTP(w, r)
|
||||
})
|
||||
mux.Handle("/music/releases/", serveReleases(app))
|
||||
|
||||
mux.HandleFunc("/artists/{id}", func(w http.ResponseWriter, r *http.Request) {
|
||||
mux.HandleFunc("/music/artists/{id}", func(w http.ResponseWriter, r *http.Request) {
|
||||
serveArtist(app, r.PathValue("id")).ServeHTTP(w, r)
|
||||
})
|
||||
mux.Handle("/artists/", http.StripPrefix("/artists", serveArtists(app)))
|
||||
mux.Handle("/music/artists/", serveArtists(app))
|
||||
|
||||
mux.HandleFunc("/tracks/{id}", func(w http.ResponseWriter, r *http.Request) {
|
||||
mux.HandleFunc("/music/tracks/{id}", func(w http.ResponseWriter, r *http.Request) {
|
||||
serveTrack(app, r.PathValue("id")).ServeHTTP(w, r)
|
||||
})
|
||||
mux.Handle("/tracks/", http.StripPrefix("/tracks", serveTracks(app)))
|
||||
mux.Handle("/music/tracks/", serveTracks(app))
|
||||
|
||||
mux.ServeHTTP(w, r)
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue