From a5ac279f6882d27b92e482125a87635d9c1ad00d Mon Sep 17 00:00:00 2001 From: Robby Zambito Date: Wed, 6 Aug 2025 19:42:43 -0400 Subject: Use /api/v1 for the API prefix --- main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index fd0b9b6..f82efac 100644 --- a/main.go +++ b/main.go @@ -13,7 +13,7 @@ import ( ) // Example: -// curl 'http://localhost:8080/v1/auth/login' -X POST -H 'Content-Type: application/json' --data-raw $'{}}\n{"king": "key"' +// curl 'http://localhost:8080/api/v1/auth/login' -X POST -H 'Content-Type: application/json' --data-raw $'{}}\n{"king": "key"' const log_length = 100 @@ -58,7 +58,7 @@ func main() { http.HandleFunc("/logs", createGetLogs(&logs)) - http.HandleFunc("/v1/auth/login", func(w http.ResponseWriter, r *http.Request) { + http.HandleFunc("/api/v1/auth/login", func(w http.ResponseWriter, r *http.Request) { body, err := io.ReadAll(r.Body) if err != nil { http.Error(w, "Bad Request", http.StatusBadRequest) @@ -81,7 +81,7 @@ func main() { http.Error(w, "Forbidden", http.StatusForbidden) }) - http.HandleFunc("/v1/king", func(w http.ResponseWriter, r *http.Request) { + http.HandleFunc("/api/v1/king", func(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, king) }) -- cgit