added comments
This commit is contained in:
@ -11,6 +11,7 @@ import (
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
// CreateMux creates and configures a mux router with authentication and post-related routes.
|
||||
func CreateMux(cfg *config.Config) (r *mux.Router) {
|
||||
db := model.Init()
|
||||
blg := posts.New(db)
|
||||
@ -22,7 +23,7 @@ func CreateMux(cfg *config.Config) (r *mux.Router) {
|
||||
// auth
|
||||
r.HandleFunc("/login", auth.Login).Methods("POST")
|
||||
r.HandleFunc("/signup", auth.Signup).Methods("POST")
|
||||
r.Handle("logout", auth.Authenticated(auth.Logout)).Methods("POST")
|
||||
r.Handle("/logout", auth.Authenticated(auth.Logout)).Methods("DELETE")
|
||||
|
||||
// Posts
|
||||
r.Handle("/posts", auth.Authenticated(blg.SavePost, model.RoleUser, model.RoleAdmin)).Methods("POST")
|
||||
|
Reference in New Issue
Block a user