Spaces:
Sleeping
Sleeping
Rename Public to Public/index.html
Browse files- Public +0 -0
- Public/index.html +34 -0
Public
DELETED
|
File without changes
|
Public/index.html
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<title>Mini Replit</title>
|
| 5 |
+
</head>
|
| 6 |
+
<body>
|
| 7 |
+
<h2>Code Runner ⚡</h2>
|
| 8 |
+
|
| 9 |
+
<textarea id="code" rows="10" cols="50">
|
| 10 |
+
console.log("Hello World")
|
| 11 |
+
</textarea>
|
| 12 |
+
|
| 13 |
+
<br />
|
| 14 |
+
<button onclick="run()">Run</button>
|
| 15 |
+
|
| 16 |
+
<pre id="output"></pre>
|
| 17 |
+
|
| 18 |
+
<script>
|
| 19 |
+
async function run() {
|
| 20 |
+
const code = document.getElementById("code").value;
|
| 21 |
+
|
| 22 |
+
const res = await fetch("/run", {
|
| 23 |
+
method: "POST",
|
| 24 |
+
headers: { "Content-Type": "application/json" },
|
| 25 |
+
body: JSON.stringify({ code })
|
| 26 |
+
});
|
| 27 |
+
|
| 28 |
+
const data = await res.json();
|
| 29 |
+
document.getElementById("output").innerText =
|
| 30 |
+
data.output || data.error;
|
| 31 |
+
}
|
| 32 |
+
</script>
|
| 33 |
+
</body>
|
| 34 |
+
</html>
|