|
|
|
@ -7,8 +7,15 @@ import ( |
|
|
|
|
func (s *server) routes() { |
|
|
|
|
s.router = mux.NewRouter() |
|
|
|
|
|
|
|
|
|
authMiddleware := s.AuthMiddleware() |
|
|
|
|
|
|
|
|
|
s.router.HandleFunc("/", s.handleIndex()).Methods("GET") |
|
|
|
|
s.router.HandleFunc("/login", s.AuthMiddleware(s.handleLogin())).Methods("GET") |
|
|
|
|
|
|
|
|
|
// if you want to use a general purpose middleware (http.Handler
|
|
|
|
|
// wrapper) on a specific HandleFunc route, you need to take the
|
|
|
|
|
// .ServeHTTP of the http.Handler to get a HandleFunc, viz:
|
|
|
|
|
s.router.HandleFunc("/login", authMiddleware(s.handleLogin()).ServeHTTP).Methods("GET") |
|
|
|
|
|
|
|
|
|
s.router.HandleFunc("/.well-known/healthcheck.json", s.handleHealthCheck()).Methods("GET") |
|
|
|
|
|
|
|
|
|
s.router.Use(s.LoggingMiddleware()) |
|
|
|
|