// Code generated by hertz generator. DO NOT EDIT. package user import ( user "acquaintances/biz/handler/user" "github.com/cloudwego/hertz/pkg/app/server" "github.com/hertz-contrib/cors" ) /* This file will register all the routes of the services in the master idl. And it will update automatically when you use the "update" command for the idl. So don't modify the contents of the file, or your code will be deleted when it is updated. */ // Register register routes based on the IDL 'api.${HTTP Method}' annotation. func Register(r *server.Hertz) { root := r.Group("/", rootMw()...) { _v1 := root.Group("/v1", _v1Mw()...) _v1.Use(cors.New(cors.Config{ // 允许的源( origins ),* 表示允许所有源(生产环境建议指定具体域名) AllowOrigins: []string{"*"}, // 允许的请求方法 AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"}, // 允许的请求头 AllowHeaders: []string{"Origin", "Content-Type", "Accept", "Authorization"}, // 是否允许发送 Cookie AllowCredentials: true, // 预检请求的有效期(秒),在此期间不需要重复发送预检请求 MaxAge: 12 * 3600, // 允许暴露的响应头(前端通过 XMLHttpRequest 可以访问的头信息) ExposeHeaders: []string{"Content-Length"}, })) { _moments := _v1.Group("/Moments", _momentsMw()...) _moments.DELETE("/", append(_deletemomentMw(), user.DeleteMoment)...) _moments.POST("/", append(_createmomentMw(), user.CreateMoment)...) { _comment := _moments.Group("/comment", _commentMw()...) _comment.DELETE("/", append(_deletecommentMw(), user.DeleteComment)...) _comment.POST("/", append(_commentmomentMw(), user.CommentMoment)...) { _list := _comment.Group("/list", _listMw()...) _list.GET("/", append(_listmomentcommentsMw(), user.ListMomentComments)...) } } { _dislike := _moments.Group("/dislike", _dislikeMw()...) _dislike.POST("/", append(_unlikemomentMw(), user.UnlikeMoment)...) } { _info := _moments.Group("/info", _infoMw()...) _info.GET("/", append(_getmomentMw(), user.GetMoment)...) } { _like := _moments.Group("/like", _likeMw()...) _like.POST("/", append(_likemomentMw(), user.LikeMoment)...) { _list0 := _like.Group("/list", _list0Mw()...) _list0.GET("/", append(_listmomentlikesMw(), user.ListMomentLikes)...) } } { _list1 := _moments.Group("/list", _list1Mw()...) _list1.GET("/", append(_listmomentsMw(), user.ListMoments)...) } { _user := _moments.Group("/user", _userMw()...) { _list2 := _user.Group("/list", _list2Mw()...) _list2.GET("/", append(_listmomentsappointMw(), user.ListMomentsAppoint)...) } } } { _cg := _v1.Group("/cg", _cgMw()...) _cg.DELETE("/", append(_deletechatgroupMw(), user.DeleteChatGroup)...) _cg.GET("/", append(_listchatgroupbyuserMw(), user.ListChatGroupByUser)...) _cg.POST("/", append(_createchatgroupMw(), user.CreateChatGroup)...) _cg.PUT("/", append(_updatechatgroupMw(), user.UpdateChatGroup)...) { _exit := _cg.Group("/exit", _exitMw()...) _exit.POST("/", append(_exitchatgroupMw(), user.ExitChatGroup)...) } { _join := _cg.Group("/join", _joinMw()...) _join.POST("/", append(_joinchatgroupMw(), user.JoinChatGroup)...) } { _users := _cg.Group("/users", _usersMw()...) _users.GET("/", append(_listuserchatgroupMw(), user.ListUserChatGroup)...) } } { _user0 := _v1.Group("/user", _user0Mw()...) _user0.DELETE("/", append(_deleteuserMw(), user.DeleteUser)...) _user0.GET("/", append(_infouserMw(), user.InfoUser)...) _user0.POST("/", append(_createuserMw(), user.CreateUser)...) _user0.PUT("/", append(_updateuserMw(), user.UpdateUser)...) { _find := _user0.Group("/find", _findMw()...) _find.GET("/", append(_finduserMw(), user.FindUser)...) } { _friendrelationship := _user0.Group("/friendRelationship", _friendrelationshipMw()...) _friendrelationship.GET("/", append(_listfriendrelationshipMw(), user.ListFriendRelationship)...) _friendrelationship.POST("/", append(_createfriendrelationshipMw(), user.CreateFriendRelationship)...) _friendrelationship.PUT("/", append(_updatefriendrelationshipMw(), user.UpdateFriendRelationship)...) } { _login := _user0.Group("/login", _loginMw()...) _login.POST("/", append(_loginuserMw(), user.LoginUser)...) } { _relation := _user0.Group("/relation", _relationMw()...) _relation.DELETE("/", append(_deleteuserrelationsMw(), user.DeleteUserRelations)...) _relation.GET("/", append(_listuserrelationsMw(), user.ListUserRelations)...) _relation.POST("/", append(_createuserrelationsMw(), user.CreateUserRelations)...) _relation.PUT("/", append(_updateuserrelationsMw(), user.UpdateUserRelations)...) } } } }