Add /cache route
This commit is contained in:
@@ -107,11 +107,11 @@ func (s *Server) AddHandler() httprouter.Handle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CachedHandler ...
|
// CacheHandler ...
|
||||||
func (s *Server) CachedHandler() httprouter.Handle {
|
func (s *Server) CacheHandler() httprouter.Handle {
|
||||||
return func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
|
return func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
|
||||||
ctx := NewContext(s.config, s.db, r)
|
ctx := NewContext(s.config, s.db, r)
|
||||||
s.render("cached", w, ctx)
|
s.render("cache", w, ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -285,6 +285,9 @@ func (s *Server) initRoutes() {
|
|||||||
|
|
||||||
s.router.GET("/search", s.SearchHandler())
|
s.router.GET("/search", s.SearchHandler())
|
||||||
|
|
||||||
|
s.router.GET("/cache/:hash", s.CacheHandler())
|
||||||
|
s.router.HEAD("/cache/:hash", s.CacheHandler())
|
||||||
|
|
||||||
s.router.GET("/login", s.am.HasAuth(s.LoginHandler()))
|
s.router.GET("/login", s.am.HasAuth(s.LoginHandler()))
|
||||||
s.router.POST("/login", s.LoginHandler())
|
s.router.POST("/login", s.LoginHandler())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user