🚚 Move hello to its own dir

This commit is contained in:
Nicolas Lepage
2021-01-22 15:28:37 +01:00
parent 078ff3547e
commit d9eacdc8e1
4 changed files with 5 additions and 17 deletions

25
docs/hello/index.html Normal file
View File

@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<title>go-wasm-http-server demo</title>
<script>
navigator.serviceWorker.register('sw.js')
async function hello() {
res = await fetch('api/hello', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ name: document.querySelector("#name").value })
})
const { message } = await res.json()
alert(message)
}
</script>
</head>
<body>
<label for="name">Name: </label><input id="name" value="World">
<button onclick="hello()">Hello</button>
</body>
</html>