Onyx-API/internal/data/controller.go

32 lines
598 B
Go
Raw Normal View History

2023-09-15 18:21:04 +02:00
package data
import (
"errors"
"net/http"
"onyx-api/internal/config"
"github.com/labstack/echo/v4"
)
type Controller struct {
cfg *config.Config
dataRepo dataRepo
}
// New controller constructor
func NewController(cfg *config.Config) *Controller {
return &Controller{cfg: cfg}
}
func (c *Controller) Ping() echo.HandlerFunc {
return func(e echo.Context) error {
return e.JSON(http.StatusOK, "pong")
}
}
func (c *Controller) GetAllProjects() echo.HandlerFunc {
return func(e echo.Context) error {
projets := ["Uno", "Dos", Tres]
return e.JSON(http.StatusOK, chargers)
}
}