godns/api/api.go
Tyler b6efd0df0c
All checks were successful
continuous-integration/drone/push Build is passing
API Implementation, patches
2021-04-15 00:41:06 -04:00

27 lines
387 B
Go

package api
import (
"github.com/go-chi/chi"
"github.com/go-chi/render"
"net/http"
)
func New() *API {
r := chi.NewRouter()
r.Use(render.SetContentType(render.ContentTypeJSON))
return &API{router: r}
}
type API struct {
router chi.Router
}
func (a *API) Router() chi.Router {
return a.router
}
func (a *API) Start() error {
return http.ListenAndServe(":8080", a.router)
}