mirror of
https://github.com/itzg/mc-router.git
synced 2024-11-24 11:55:24 +01:00
18 lines
354 B
Go
18 lines
354 B
Go
|
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")
|
||
|
}()
|
||
|
}
|