From a9adc633ab411e2391f2a842ee630931b5da8c61 Mon Sep 17 00:00:00 2001 From: UnicodingUnicorn <7555ic@gmail.com> Date: Sat, 16 Mar 2019 02:21:41 +0800 Subject: [PATCH] Removed trailing slashes in handler routes. Fixes issue #5 --- main.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/main.go b/main.go index 5a3378e..9ecbd38 100644 --- a/main.go +++ b/main.go @@ -39,27 +39,27 @@ func main() { // Routes router := httprouter.New() // Users - router.POST("/user/", h.CreateUser) - router.GET("/user/", h.GetUsersByPhone) + router.POST("/user", h.CreateUser) + router.GET("/user", h.GetUsersByPhone) router.GET("/user/id/:user", h.GetUser) //router.PATCH("/user/:user", h.UpdateUser) // Conversations - router.POST("/user/conversation/", AuthMiddleware(h.CreateConversation)) - router.GET("/user/conversation/", AuthMiddleware(h.GetConversations)) // USER MEMBER CONVERSATION + router.POST("/user/conversation", AuthMiddleware(h.CreateConversation)) + router.GET("/user/conversation", AuthMiddleware(h.GetConversations)) // USER MEMBER CONVERSATION router.DELETE("/user/conversation/:conversation", AuthMiddleware(h.DeleteConversation)) //router.GET("/user/:user/conversation/bymembers/", h.GetConversationsByMembers) // TODO router.GET("/user/conversation/:conversation", AuthMiddleware(h.GetConversation)) // USER MEMBER CONVERSATION router.PATCH("/user/conversation/:conversation", AuthMiddleware(h.UpdateConversation)) // USER MEMBER CONVERSATION ADMIN=true -> update conversation title //router.DELETE("/user/:user/conversation/:conversation", h.DeleteConversation) // USER MEMBER CONVERSATION -> delete membership - router.POST("/user/conversation/:conversation/member/", AuthMiddleware(h.CreateConversationMember)) // USER MEMBER CONVERSATION ADMIN=true -> create new membership - router.GET("/user/conversation/:conversation/member/", AuthMiddleware(h.GetConversationMembers)) // USER MEMBER CONVERSATION + router.POST("/user/conversation/:conversation/member", AuthMiddleware(h.CreateConversationMember)) // USER MEMBER CONVERSATION ADMIN=true -> create new membership + router.GET("/user/conversation/:conversation/member", AuthMiddleware(h.GetConversationMembers)) // USER MEMBER CONVERSATION //router.DELETE("/user/:user/conversation/:conversation/member/:member", h.DeleteConversationMember) // USER MEMBER CONVERSATION ADMIN=true -> delete membership // Last heard //router.GET("/user/:user/lastheard/:conversation", h.GetLastheard) //router.PUT("/user/:user/lastheard/:conversation", h.SetLastheard) // Contacts - router.POST("/user/contact/", AuthMiddleware(h.CreateContact)) - router.GET("/user/contact/", AuthMiddleware(h.GetContacts)) + router.POST("/user/contact", AuthMiddleware(h.CreateContact)) + router.GET("/user/contact", AuthMiddleware(h.GetContacts)) //router.GET("/user/:user/contact/:contact", h.GetContact) //router.DELETE("/user/:user/contact/:contact", h.DeleteContact) //router.GET("/user/:user/contact/:contact/conversation/", h.GetContactConversations)