32 lines
598 B
Go
32 lines
598 B
Go
|
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)
|
||
|
}
|
||
|
}
|