update and delete
This commit is contained in:
@ -30,7 +30,9 @@ func main() {
|
||||
r := mux.NewRouter()
|
||||
r.Use(cors.HandlerForOrigin("*"))
|
||||
r.Handle("/login", auth.Login(user, password, []byte(secret))).Methods("POST")
|
||||
r.Handle("/posts", auth.Authenticated([]byte(secret))(blg.CreatePost)).Methods("POST")
|
||||
r.Handle("/posts", auth.Authenticated([]byte(secret))(blg.SavePost)).Methods("POST")
|
||||
r.Handle("/posts", auth.Authenticated([]byte(secret))(blg.SavePost)).Methods("PUT")
|
||||
r.Handle("/posts/{postID}", auth.Authenticated([]byte(secret))(blg.DeletePost)).Methods("DELETE")
|
||||
r.Handle("/posts", http.HandlerFunc(blg.GetAllPosts)).Methods("GET")
|
||||
r.Methods("OPTIONS").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// The CORS middleware should set up the headers for you
|
||||
|
Reference in New Issue
Block a user