Skip to content

Commit 82f3cf4

Browse files
author
jh3r
committed
Set router
1 parent b08a9cd commit 82f3cf4

File tree

5 files changed

+38
-10
lines changed

5 files changed

+38
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.vscode/
2+
npm-debug.log
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package bizs
2+
3+
import (
4+
"gopkg.in/baa.v1"
5+
)
6+
7+
// agentBiz 业务类
8+
type agentBiz struct{}
9+
10+
// AgentBiz 暴露业务类实例
11+
var AgentBiz = agentBiz{}
12+
13+
// ExecuteBuild 执行构建
14+
func (a agentBiz) ExecuteBuild(c *baa.Context) {
15+
16+
}
17+
18+
// ProcessPing 处理ping请求,校验存活
19+
func (a agentBiz) ProcessPing(c *baa.Context) {
20+
c.Text(200, []byte("PONG"))
21+
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package main
22

33
import (
4+
"adpagent2/router"
5+
46
"gopkg.in/baa.v1"
57
)
68

79
func main() {
810
app := baa.New()
9-
Router(app)
11+
router.AttachToApp(app)
1012
app.Run(":7777")
1113
}

packages/adp-agent/src/adpagent2/router.go

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package router
2+
3+
import (
4+
"adpagent2/bizs"
5+
6+
"gopkg.in/baa.v1"
7+
)
8+
9+
// AttachToApp 挂载Router
10+
func AttachToApp(b *baa.Baa) {
11+
b.Get("/", bizs.AgentBiz.ExecuteBuild)
12+
b.Get("/ping", bizs.AgentBiz.ProcessPing)
13+
}

0 commit comments

Comments
 (0)