rust-web/public/index.html
2021-10-22 13:01:48 +02:00

71 lines
No EOL
1.9 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<style>
body {
max-width: 70ch;
margin: auto;
padding: 3em 1em;
line-height: 1.75;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: 1.25em;
color: #444
}
h1, h2, h3, h4, h5, h6 {
line-height: 1.2;
margin: 3em 0 1em;
}
p, ul, ol {
margin-bottom: 2em;
color: #1d1d1d;
font-family: sans-serif;
}
@media (prefers-color-scheme: dark) {
body {
color: white;
background: #444
}
a:link {
color: #5bf
}
a:visited {
color: #ccf
}
}
</style>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=5.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="description" content="Simple client for rust actix back end">
<title>Rust client</title>
</head>
<body>
<h1>Rust client</h1>
<pre id="result">
hi
</pre>
</body>
<script>
const consoleSignatureStyle = "font-size: 16px;" +
"background: linear-gradient(to right, #e66465, #9198e5);" +
"color: white;" +
"text-align: center;" +
"padding: 10px 15px;" +
"width: 100%;" +
"border-radius: 20px;";
const welcomeMessage = "Welcome to Rust client ⚙️"
console.log(`%c ${welcomeMessage}`, consoleSignatureStyle)
let data = document.querySelector("#result")
fetch("http://localhost:8000/")
.then(res => res.json())
.then(json => data.innerHTML = JSON.stringify(json, null, 2))
</script>
</html>