This is my personal framework to be used to kickstart the creation of services with a few minimum niceties.
package main
import (
"net/http"
"github.com/coldfgirl/digi"
"github.com/labstack/echo/v4"
)
type example struct{}
func (e *example) Name() string {
return "example"
}
func (e *example) Start(logger digi.Logger, i *digi.Injector) error {
logger.Info("Inside the example!")
web, err := i.GetWeb()
if err != nil {
return err
}
web.GET("/example", func(c echo.Context) error {
return c.String(http.StatusOK, "Inside the handler!")
})
return nil
}
func (e *example) Stop() error {
return nil
}
func main() {
digi.NewServer().Start(&example{}).Wait()
}