summaryrefslogtreecommitdiff
path: root/demo.html
diff options
context:
space:
mode:
Diffstat (limited to 'demo.html')
-rw-r--r--demo.html32
1 files changed, 32 insertions, 0 deletions
diff --git a/demo.html b/demo.html
new file mode 100644
index 0000000..4becabe
--- /dev/null
+++ b/demo.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Axum Echo</title>
+</head>
+<body>
+ <h1>Axum Echo Demo</h1>
+
+ <input id="name" type="text" placeholder="Your name" />
+ <button onclick="send()">Send</button>
+
+ <br><br>
+ <textarea id="output" rows="5" cols="40"></textarea>
+
+ <script>
+ async function send() {
+ const name = document.getElementById("name").value;
+
+ const res = await fetch(`/api/echo?name=${encodeURIComponent(name)}`, {
+ method: "POST"
+ });
+
+ const data = await res.json();
+ document.getElementById("output").value =
+ `Hello ${data.name}\nSession ID: ${data.session_id}`;
+
+ localStorage.setItem("session_id", data.session_id);
+ }
+ </script>
+</body>
+</html>