From 3eb0254943392452ceddbb7b310e5c1c1fd4b319 Mon Sep 17 00:00:00 2001 From: Carl Jackson Date: Sat, 12 Apr 2014 21:01:20 +0100 Subject: [PATCH] Clarify /admin/ vs /admin in example app I'm not particularly satisfied with the solution here. Maybe the answer is "more middleware," but I'm not sure. --- example/main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/example/main.go b/example/main.go index c4b331a..0fa57b2 100644 --- a/example/main.go +++ b/example/main.go @@ -46,9 +46,13 @@ func main() { goji.Handle("/admin/*", admin) admin.Use(SuperSecure) + // Goji's routing, like Sinatra's, is exact: no effort is made to + // normalize trailing slashes. + goji.Get("/admin", http.RedirectHandler("/admin/", 301)) + // Set up admin routes. Note that sub-routes do *not* mutate the path in - // any way, so we need to supply full ("/admin" prefixed) paths. - admin.Get("/admin", AdminRoot) + // any way, so we need to supply full ("/admin/" prefixed) paths. + admin.Get("/admin/", AdminRoot) admin.Get("/admin/finances", AdminFinances) // Use a custom 404 handler