Recount-Server/web/router.go

27 lines
468 B
Go

package web
import (
"net/http"
"context"
"github.com/go-chi/chi/v5"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)
func SetLogLevel(level zerolog.Level) {
zerolog.SetGlobalLevel(level)
}
func WebRouter() http.Handler {
r := chi.NewRouter()
r.Get("/", getIndex)
return r
}
func getIndex(w http.ResponseWriter, req *http.Request) {
log.Debug().Msg("Got index")
component := hello("Nick")
component.Render(context.Background(), w)
}