4
1
Fork 0

Removed trailing slashes in handler routes. Fixes issue #5

pull/24/head
UnicodingUnicorn 2019-03-16 02:21:41 +08:00
parent 6b446d85d0
commit a9adc633ab
1 changed files with 8 additions and 8 deletions

16
main.go
View File

@ -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)