-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.go
More file actions
37 lines (29 loc) · 740 Bytes
/
Copy pathmain.go
File metadata and controls
37 lines (29 loc) · 740 Bytes
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
package main
import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/xuqingfeng/BondReminderBot/bond"
)
func main() {
go bond.Process()
e := echo.New()
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "Hey there!")
})
e.POST("/fetch", func(c echo.Context) error {
err := bond.FetchFutureBonds()
if err != nil {
return c.String(http.StatusInternalServerError, err.Error())
}
return c.String(http.StatusOK, "OK")
})
// 上市提醒 + 打新提醒
e.POST("/notify", func(c echo.Context) error {
err := bond.Notify()
if err != nil {
return c.String(http.StatusInternalServerError, err.Error())
}
return c.String(http.StatusOK, "OK")
})
e.Logger.Fatal(e.Start(":8000"))
}