@@ -12,22 +12,20 @@ func (app *App) Routes() http.Handler {
12
12
13
13
mux .Get ("/" , http .HandlerFunc (app .Home ))
14
14
15
- mux .Get ("/snippet/new" , http .HandlerFunc (app .NewSnippet ))
16
- mux .Post ("/snippet/new" , http .HandlerFunc (app .CreateSnippet ))
15
+ mux .Get ("/snippet/new" , alice . New ( app . RequireLogin ). Then ( http .HandlerFunc (app .NewSnippet ) ))
16
+ mux .Post ("/snippet/new" , alice . New ( app . RequireLogin ). Then ( http .HandlerFunc (app .CreateSnippet ) ))
17
17
mux .Get ("/snippet/:id" , http .HandlerFunc (app .ShowSnippet ))
18
18
19
19
mux .Get ("/user/signup" , http .HandlerFunc (app .SignupUser ))
20
20
mux .Post ("/user/signup" , http .HandlerFunc (app .CreateUser ))
21
21
mux .Get ("/user/login" , http .HandlerFunc (app .LoginUser ))
22
22
mux .Post ("/user/login" , http .HandlerFunc (app .VerifyUser ))
23
- mux .Post ("/user/logout" , http .HandlerFunc (app .LogoutUser ))
23
+ mux .Post ("/user/logout" , alice . New ( app . RequireLogin ). Then ( http .HandlerFunc (app .LogoutUser ) ))
24
24
25
25
fileServer := http .FileServer (http .Dir (app .staticDir ))
26
26
mux .Get ("/static/" , http .StripPrefix ("/static" , DisableIndex (fileServer )))
27
27
28
28
mux .Get ("/version" , http .HandlerFunc (app .VersionInfo ))
29
29
30
- chain := alice .New (LogRequest , SecureHeaders ).Then (mux )
31
-
32
- return chain
30
+ return alice .New (LogRequest , SecureHeaders ).Then (mux )
33
31
}
0 commit comments