mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
refactor ping handler
This commit is contained in:
parent
42e5c88a2f
commit
f2686d02b0
|
@ -62,16 +62,14 @@ func (s *Server) Run(ctx context.Context) error {
|
||||||
MaxAge: 12 * time.Hour,
|
MaxAge: 12 * time.Hour,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
r.GET("/api/ping", func(c *gin.Context) {
|
r.GET("/api/ping", s.ping)
|
||||||
c.JSON(http.StatusOK, gin.H{"message": "pong"})
|
|
||||||
})
|
|
||||||
|
|
||||||
if s.Setup != nil {
|
if s.Setup != nil {
|
||||||
r.POST("/api/setup/test-db", s.setupTestDB)
|
r.POST("/api/setup/test-db", s.setupTestDB)
|
||||||
r.POST("/api/setup/configure-db", s.setupConfigureDB)
|
r.POST("/api/setup/configure-db", s.setupConfigureDB)
|
||||||
r.POST("/api/setup/restart", s.setupRestart)
|
|
||||||
r.POST("/api/setup/save", s.setupSaveConfig)
|
|
||||||
r.POST("/api/setup/strategy/single/:id/session/:session", s.setupAddStrategy)
|
r.POST("/api/setup/strategy/single/:id/session/:session", s.setupAddStrategy)
|
||||||
|
r.POST("/api/setup/save", s.setupSaveConfig)
|
||||||
|
r.POST("/api/setup/restart", s.setupRestart)
|
||||||
}
|
}
|
||||||
|
|
||||||
r.GET("/api/trades", func(c *gin.Context) {
|
r.GET("/api/trades", func(c *gin.Context) {
|
||||||
|
@ -475,6 +473,10 @@ func (s *Server) setupConfigureDB(c *gin.Context) {
|
||||||
c.JSON(http.StatusOK, gin.H{"success": true})
|
c.JSON(http.StatusOK, gin.H{"success": true})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) ping(c *gin.Context) {
|
||||||
|
c.JSON(http.StatusOK, gin.H{"message": "pong"})
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Server) setupAddStrategy(c *gin.Context) {
|
func (s *Server) setupAddStrategy(c *gin.Context) {
|
||||||
sessionName := c.Param("session")
|
sessionName := c.Param("session")
|
||||||
strategyID := c.Param("id")
|
strategyID := c.Param("id")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user