-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrouter.go
62 lines (48 loc) · 2.63 KB
/
router.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package main
import (
"net/http"
"wall-backend/internal/middleware"
"github.com/gin-gonic/gin"
)
func InitRoute(r *gin.Engine) {
r.Use(middleware.CorsHandler)
api := r.Group("/api")
{
api.POST("register", RegisterController.Register)
authserver := api.Group("/authserver")
authserver.POST("/authenticate", AuthController.Authenticate)
authserver.POST("/refresh", AuthController.Refresh)
authserver.POST("/signout", AuthController.Signout)
authserver.POST("/validate", AuthController.Validate)
profile := api.Group("/profile")
profile.GET("/user-info", middleware.AuthToken, ProfileController.GetUserInfo)
profile.GET("/expressions", middleware.AuthToken, ProfileController.FetchUserExpressions)
profile.POST("/nickname/edit", middleware.AuthToken, ProfileController.EditNickName)
profile.PUT("/avatar/upload", middleware.AuthToken, ProfileController.UploadUserAvatar)
profile.POST("/password/change", middleware.AuthToken, ProfileController.ChangePassword)
userBlacklist := profile.Group("/user-blacklist")
userBlacklist.POST("/add", middleware.AuthToken, BlacklistController.AddUserIntoBlacklist)
userBlacklist.DELETE("/remove", middleware.AuthToken, BlacklistController.RemoveUserFromBlacklist)
userBlacklist.GET("/get", middleware.AuthToken, BlacklistController.GetUserBlacklist)
expressionBlacklist := profile.Group("/expression-blacklist")
expressionBlacklist.POST("/add", middleware.AuthToken, BlacklistController.AddExpressionIntoBlacklist)
expressionBlacklist.DELETE("/remove", middleware.AuthToken, BlacklistController.RemoveExpressionFromBlacklist)
expressionBlacklist.GET("/get", middleware.AuthToken, BlacklistController.GetExpressionBlacklist)
community := api.Group("/community")
community.GET("/expressions", CommunityController.FetchAllExpression)
community.GET("/expression", CommunityController.FetchTargetedExpression)
community.GET("/review", CommunityController.FetchAllReviewOfExpression)
expression := api.Group("/express")
expression.POST("/publish", middleware.AuthToken, ExpressController.Publish)
expression.PUT("/edit", middleware.AuthToken, ExpressController.Edit)
expression.DELETE("/delete", middleware.AuthToken, ExpressController.Delete)
review := api.Group("/review")
review.POST("/publish", middleware.AuthToken, ReviewController.Publish)
review.DELETE("/delete", middleware.AuthToken, ReviewController.Delete)
review.PUT("/edit", middleware.AuthToken, ReviewController.Edit)
// review.POST("/reply", middleware.AuthToken, ReviewController.Reply)
api.StaticFS("/static", http.Dir("static"))
}
r.NoMethod(middleware.NotFoundHandler)
r.NoRoute(middleware.NotFoundHandler)
}