skeleton/internal/web/server.go

25 lines
408 B
Go
Raw Normal View History

2019-05-14 14:11:03 +02:00
package web
import (
"net/http"
"github.com/go-chi/chi"
"bitmask.me/skeleton/internal/app"
)
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)
}