diff options
author | Robby Zambito <contact@robbyzambito.me> | 2025-08-06 19:42:43 -0400 |
---|---|---|
committer | Robby Zambito <contact@robbyzambito.me> | 2025-08-06 19:44:31 -0400 |
commit | a5ac279f6882d27b92e482125a87635d9c1ad00d (patch) | |
tree | 527e5ab68a3e605ec2b6d7ebd32a057971796201 /main.go | |
parent | d35903bf5b56cc40e3b61d34f57c192d6a8b3430 (diff) |
Use /api/v1 for the API prefix
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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) }) |