rove/cmd/rove-server/router.go

29 lines
517 B
Go
Raw Normal View History

package main
import (
"encoding/json"
"net/http"
"github.com/gorilla/mux"
2020-05-29 23:05:37 +01:00
"github.com/mdiluz/rove/pkg/rove"
)
func NewRouter() (router *mux.Router) {
// Create a new router
router = mux.NewRouter().StrictSlash(true)
// Set up the handlers
router.HandleFunc("/status", HandleStatus)
return
}
// HandleStatus handles HTTP requests to the /status endpoint
func HandleStatus(w http.ResponseWriter, r *http.Request) {
2020-05-29 23:05:37 +01:00
var status = rove.ServerStatus{
Ready: true,
}
json.NewEncoder(w).Encode(status)
}