skeleton/internal/web/server.go

25 lines
408 B
Go
Raw Permalink Normal View History

2019-05-14 14:11:03 +02:00
package web
import (
"net/http"
"bitmask.me/skeleton/internal/app"
2020-07-20 00:50:05 +02:00
"github.com/go-chi/chi"
2019-05-14 14:11:03 +02:00
)
func runHTTP(listenAddr string, h http.Handler) error {
server := &http.Server{
Addr: listenAddr,
Handler: h,
}
return server.ListenAndServe()
}
// RunServer starts the web server
func RunServer(ac *app.App, listenAddr string) {
r := chi.NewMux()
registerRoutes(ac, r)
runHTTP(listenAddr, r)
}