28 lines
486 B
Go
28 lines
486 B
Go
|
package apiv2
|
||
|
|
||
|
import (
|
||
|
"github.com/labstack/echo/v4"
|
||
|
"gitrepo.ru/neonxp/idecnode/pkg/config"
|
||
|
"gitrepo.ru/neonxp/idecnode/pkg/idec"
|
||
|
)
|
||
|
|
||
|
type API struct {
|
||
|
config *config.Config
|
||
|
idec *idec.IDEC
|
||
|
}
|
||
|
|
||
|
func New(i *idec.IDEC, cfg *config.Config) *API {
|
||
|
return &API{
|
||
|
config: cfg,
|
||
|
idec: i,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (a *API) Register(e *echo.Echo) {
|
||
|
func(g *echo.Group) {
|
||
|
g.GET("/list", a.getListHandler)
|
||
|
g.GET("/e", a.getEchoHandler)
|
||
|
g.GET("/m", a.getMessagesHandler)
|
||
|
}(e.Group("/api"))
|
||
|
}
|