go-pass-gen/api/server.go
2021-10-21 12:16:24 +02:00

23 lines
366 B
Go

package api
import (
"net/http"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
)
type Server struct {
Router *chi.Mux
}
func NewServer() *Server {
s := &Server{Router: chi.NewRouter()}
s.Router.Use(middleware.Logger)
s.routes()
return s
}
func (s Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
s.Router.ServeHTTP(w, r)
}