summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobby Zambito <contact@robbyzambito.me>2025-08-06 19:42:43 -0400
committerRobby Zambito <contact@robbyzambito.me>2025-08-06 19:44:31 -0400
commita5ac279f6882d27b92e482125a87635d9c1ad00d (patch)
tree527e5ab68a3e605ec2b6d7ebd32a057971796201
parentd35903bf5b56cc40e3b61d34f57c192d6a8b3430 (diff)
Use /api/v1 for the API prefix
-rw-r--r--current_king.py2
-rw-r--r--main.go6
-rw-r--r--static/contact-script.js2
-rw-r--r--static/login-script.js2
4 files changed, 6 insertions, 6 deletions
diff --git a/current_king.py b/current_king.py
index 4334140..6bd06b7 100644
--- a/current_king.py
+++ b/current_king.py
@@ -4,7 +4,7 @@ import urllib.error
def get_king_data():
"""Request data from localhost king endpoint and return response body as string."""
try:
- with urllib.request.urlopen("http://localhost:8080/v1/king") as response:
+ with urllib.request.urlopen("http://localhost:8080/api/v1/king") as response:
return response.read().decode('utf-8')
except urllib.error.URLError as e:
raise Exception(f"Failed to fetch king data: {e}")
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)
})
diff --git a/static/contact-script.js b/static/contact-script.js
index d436dd5..7f40271 100644
--- a/static/contact-script.js
+++ b/static/contact-script.js
@@ -125,7 +125,7 @@ const showToast = (message, type = 'success') => {
};
// API Configuration
-const API_BASE_URL = 'https://api.taskflow.com/v1';
+const API_BASE_URL = '/api/v1';
const CONTACT_ENDPOINT = `${API_BASE_URL}/contact`;
// Submit contact form
diff --git a/static/login-script.js b/static/login-script.js
index 2500cca..4e80b5c 100644
--- a/static/login-script.js
+++ b/static/login-script.js
@@ -12,7 +12,7 @@ const passwordError = document.getElementById('passwordError');
const generalError = document.getElementById('generalError');
// API Configuration
-const API_BASE_URL = '/v1';
+const API_BASE_URL = '/api/v1';
const LOGIN_ENDPOINT = `${API_BASE_URL}/auth/login`;
// Password visibility toggle