Esempio n. 1
0
func main() {
	router := violetear.New()
	router.LogRequests = true

	router.HandleFunc("/*", mainHandler)
	router.HandleFunc("/_healthcheck_", healthCheck)

	log.Fatal(http.ListenAndServe(":8000", router))
}
Esempio n. 2
0
func TestHealthcheck(t *testing.T) {
	router := violetear.New()
	router.LogRequests = false
	err := router.HandleFunc("/_healthcheck_", healthCheck)
	expect(t, err, nil)
	w := httptest.NewRecorder()
	req, _ := http.NewRequest("GET", "/_healthcheck_", nil)
	router.ServeHTTP(w, req)
	expect(t, w.Code, 200)
}