start server

This commit is contained in:
Fran Jurmanović
2024-07-11 19:07:55 +02:00
parent 8307a60913
commit 475a2bb4c4
6 changed files with 83 additions and 3 deletions

View File

@@ -28,6 +28,7 @@ func NewApiController(as *service.ApiService, routeGroups *common.RouteGroups) *
}
routeGroups.Api.Get("", ac.getFirst)
routeGroups.Api.Post("", ac.startServer)
return ac
}
@@ -43,3 +44,19 @@ func (ac *ApiController) getFirst(c *fiber.Ctx) error {
apiModel := ac.service.GetFirst(c)
return c.SendString(apiModel)
}
// startServer returns API
//
// @Summary Return API
// @Description Return API
// @Tags api
// @Success 200 {array} string
// @Router /v1/api [post]
func (ac *ApiController) startServer(c *fiber.Ctx) error {
c.Locals("service", "ACC-Server")
apiModel, err := ac.service.StartServer(c)
if err != nil {
return c.SendStatus(400)
}
return c.SendString(apiModel)
}