mc-router/server/api_server.go

18 lines
354 B
Go
Raw Normal View History

2018-05-08 05:16:01 +02:00
package server
import (
"net/http"
"github.com/sirupsen/logrus"
"github.com/gorilla/mux"
)
var apiRoutes = mux.NewRouter()
func StartApiServer(apiBinding string) {
logrus.WithField("binding", apiBinding).Info("Serving API requests")
go func() {
logrus.WithError(
http.ListenAndServe(apiBinding, apiRoutes)).Error("API server failed")
}()
}