package api
import (
+ "fmt"
+
+ "github.com/gin-gonic/gin"
"github.com/jinzhu/gorm"
"github.com/vapor/toolbar/precog/config"
+ "github.com/vapor/toolbar/precog/database/orm"
)
type server struct {
}
func (s *server) Run() {
- // setup gin
+ router := gin.Default()
+
+ router.POST("/list-nodes", listNodes)
- // disable log
+ router.Run(fmt.Sprintf(":%d", s.cfg.API.ListeningPort))
+}
- // set up router, bind handler
+// TODO: cannot use listNodes (type func(*gin.Context) ([]*orm.Node, error)) as type gin.HandlerFunc in argument to router.RouterGroup.POST
+func listNodes(_ *gin.Context) ([]*orm.Node, error) {
+ return nil, nil
}