24 lines
408 B
Go
24 lines
408 B
Go
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)
|
|
}
|