This commit is contained in:
Nicolas Lepage 2019-11-27 11:44:54 +01:00
parent b52bda2aca
commit e89ed3ec01
No known key found for this signature in database
GPG Key ID: B0879E35E66D8F6F
4 changed files with 18 additions and 3 deletions

View File

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

View File

@ -4,6 +4,6 @@ importScripts(
)
wasmhttp.serve({
wasm: 'test.wasm',
base: '/test',
wasm: 'api.wasm',
base: '/api',
})