mirror of
https://github.com/nlepage/go-wasm-http-server.git
synced 2026-01-12 01:59:14 +00:00
🚚 Move hello to its own dir
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>go-wasm-http-server demo</title>
|
||||
<script>
|
||||
navigator.serviceWorker.register('sw.js').then(reg => {
|
||||
if(reg.installing) {
|
||||
console.log('Service worker installing')
|
||||
} else if(reg.waiting) {
|
||||
console.log('Service worker installed')
|
||||
} else if(reg.active) {
|
||||
console.log('Service worker active')
|
||||
}
|
||||
})
|
||||
|
||||
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>
|
||||
Reference in New Issue
Block a user