mirror of
https://github.com/nlepage/go-wasm-http-server.git
synced 2025-03-11 01:29:11 +00:00
⚗️
This commit is contained in:
parent
b52bda2aca
commit
e89ed3ec01
@ -1,7 +1,22 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<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>
|
<body>
|
||||||
|
<label for="name">Name : </label><input id="name" value="World">
|
||||||
|
<button onclick="hello">Hello</button>
|
||||||
<script>
|
<script>
|
||||||
navigator.serviceWorker.register('sw.js')
|
navigator.serviceWorker.register('sw.js')
|
||||||
</script>
|
</script>
|
||||||
|
@ -4,6 +4,6 @@ importScripts(
|
|||||||
)
|
)
|
||||||
|
|
||||||
wasmhttp.serve({
|
wasmhttp.serve({
|
||||||
wasm: 'test.wasm',
|
wasm: 'api.wasm',
|
||||||
base: '/test',
|
base: '/api',
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user