diff --git a/http/http.go b/http/http.go index 9aa9201..d40572e 100644 --- a/http/http.go +++ b/http/http.go @@ -19,6 +19,9 @@ const ( DOMAIN_ACCESS = "domain" TRANSACTION_ID = "transaction_id" + ROUTE_ROOT = "/" + ROUTE_AUTH = "/toto" + RETURN_VALUE_OK = "OK" RETURN_VALUE_NOK = "NOK" ) @@ -62,6 +65,7 @@ func authHandler(w http.ResponseWriter, r *http.Request) { if answer { ret = RETURN_VALUE_OK } + // TODO reply with JSON format fmt.Fprintf(w, ret) } @@ -69,8 +73,9 @@ func authHandler(w http.ResponseWriter, r *http.Request) { func Run() { log.Printf("%sRunning", LogInfo) - http.HandleFunc("/", indexHandler) // set router - http.HandleFunc("/toto", authHandler) + + http.HandleFunc(ROUTE_ROOT, indexHandler) + http.HandleFunc(ROUTE_AUTH, authHandler) port := strconv.Itoa(HttpPortBind) log.Printf("%sListenning on port %s", LogInfo, port)