mirror of
https://github.com/nlepage/go-wasm-http-server.git
synced 2026-01-12 01:59:14 +00:00
⚗️
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
@@ -10,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
defer fmt.Println("api stopping...")
|
||||
defer fmt.Println("api stopped...")
|
||||
|
||||
http.HandleFunc("/hello", func(res http.ResponseWriter, req *http.Request) {
|
||||
params := make(map[string]string)
|
||||
@@ -25,8 +24,5 @@ func main() {
|
||||
}
|
||||
})
|
||||
|
||||
var release = wasmhttp.Serve(nil)
|
||||
defer release()
|
||||
|
||||
<-context.Background().Done()
|
||||
wasmhttp.Serve(nil)
|
||||
}
|
||||
|
||||
BIN
docs/api.wasm
BIN
docs/api.wasm
Binary file not shown.
@@ -8,4 +8,4 @@ addEventListener('activate', event => {
|
||||
event.waitUntil(clients.claim())
|
||||
})
|
||||
|
||||
registerWasmHTTPListener('api.wasm', 'api')
|
||||
registerWasmHTTPListener('api.wasm', { base: 'api' })
|
||||
|
||||
Reference in New Issue
Block a user