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
3d97d94c35
commit
22f54438b8
@ -8,6 +8,8 @@ import (
|
||||
wasmhttp "github.com/nlepage/go-wasm-http-server"
|
||||
)
|
||||
|
||||
var no = 1
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/hello", func(res http.ResponseWriter, req *http.Request) {
|
||||
params := make(map[string]string)
|
||||
@ -16,10 +18,11 @@ func main() {
|
||||
}
|
||||
|
||||
if err := json.NewEncoder(res).Encode(map[string]string{
|
||||
"message": fmt.Sprintf("Hello %s!", params["name"]),
|
||||
"message": fmt.Sprintf("Hello %s! (%d)", params["name"], no),
|
||||
}); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
no++
|
||||
})
|
||||
|
||||
wasmhttp.Serve(nil)
|
||||
|
BIN
docs/api.wasm
BIN
docs/api.wasm
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user