diff options
Diffstat (limited to 'pkg/apiv2/api.go')
-rw-r--r-- | pkg/apiv2/api.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/pkg/apiv2/api.go b/pkg/apiv2/api.go new file mode 100644 index 0000000..8fbd759 --- /dev/null +++ b/pkg/apiv2/api.go @@ -0,0 +1,27 @@ +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")) +} |