mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Fix input async tasks + tests (#137)
This commit is contained in:
@@ -30,7 +30,7 @@ type Server struct {
|
||||
|
||||
func New(ds models.Datastore, mq models.MessageQueue, r *runner.Runner) *Server {
|
||||
Api = &Server{
|
||||
Router: gin.Default(),
|
||||
Router: gin.New(),
|
||||
Datastore: ds,
|
||||
MQ: mq,
|
||||
Runner: r,
|
||||
@@ -150,6 +150,8 @@ func (s *Server) Run(ctx context.Context) {
|
||||
}
|
||||
|
||||
func bindHandlers(engine *gin.Engine, reqHandler func(ginC *gin.Context), taskHandler func(ginC *gin.Context)) {
|
||||
engine.Use(gin.Logger())
|
||||
|
||||
engine.GET("/", handlePing)
|
||||
engine.GET("/version", handleVersion)
|
||||
|
||||
@@ -185,3 +187,28 @@ func bindHandlers(engine *gin.Engine, reqHandler func(ginC *gin.Context), taskHa
|
||||
func simpleError(err error) *models.Error {
|
||||
return &models.Error{&models.ErrorBody{Message: err.Error()}}
|
||||
}
|
||||
|
||||
type appResponse struct {
|
||||
Message string `json:"message"`
|
||||
App *models.App `json:"app"`
|
||||
}
|
||||
|
||||
type appsResponse struct {
|
||||
Message string `json:"message"`
|
||||
Apps models.Apps `json:"apps"`
|
||||
}
|
||||
|
||||
type routeResponse struct {
|
||||
Message string `json:"message"`
|
||||
Route *models.Route `json:"route"`
|
||||
}
|
||||
|
||||
type routesResponse struct {
|
||||
Message string `json:"message"`
|
||||
Routes models.Routes `json:"routes"`
|
||||
}
|
||||
|
||||
type tasksResponse struct {
|
||||
Message string `json:"message"`
|
||||
Task models.Task `json:"tasksResponse"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user