-
Notifications
You must be signed in to change notification settings - Fork 11
/
router.go
64 lines (52 loc) · 1.99 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
63
64
package main
import (
"github.com/buaazp/fasthttprouter"
"github.com/phachon/wmqx/app/controllers"
)
type Router struct {
}
// return router
func NewRouter() *Router {
return &Router{}
}
// api manager server router
func (r *Router) Api() *fasthttprouter.Router {
router := fasthttprouter.New()
// message router
messageController := controllers.NewMessageController()
router.POST("/message/add", messageController.Add)
router.POST("/message/update", messageController.Update)
router.GET("/message/delete", messageController.Delete)
router.GET("/message/status", messageController.Status)
router.GET("/message/list", messageController.List)
router.GET("/message/getMessageByName", messageController.GetMessageByName)
router.GET("/message/getConsumersByName", messageController.GetConsumersByName)
router.GET("/message/reload", messageController.Reload)
// consumer router
consumerController := controllers.NewConsumerController()
router.POST("/consumer/add", consumerController.Add)
router.POST("/consumer/update", consumerController.Update)
router.GET("/consumer/delete", consumerController.Delete)
router.GET("/consumer/status", consumerController.Status)
router.GET("/consumer/getConsumerById", consumerController.GetConsumerById)
// system router
systemController := controllers.NewSystemController()
router.GET("/system/reload", systemController.Reload)
router.GET("/system/index", systemController.Index)
router.GET("/", systemController.Index)
// log router
logController := controllers.NewLogController()
router.GET("/log/search", logController.Search)
router.GET("/log/list", logController.List)
router.GET("/log/download", logController.Download)
return router
}
// publish server router
func (r *Router) Publish() *fasthttprouter.Router {
router := fasthttprouter.New()
// publish router
publishController := controllers.NewPublishController()
router.GET("/publish/:name", publishController.Publish)
router.POST("/publish/:name", publishController.Publish)
return router
}