mirror of
https://github.com/nlepage/go-wasm-http-server.git
synced 2025-03-10 17:29:10 +00:00
⚗️
This commit is contained in:
parent
b52bda2aca
commit
e89ed3ec01
@ -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>
|
||||
|
@ -4,6 +4,6 @@ importScripts(
|
||||
)
|
||||
|
||||
wasmhttp.serve({
|
||||
wasm: 'test.wasm',
|
||||
base: '/test',
|
||||
wasm: 'api.wasm',
|
||||
base: '/api',
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user