diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 0000000..4b9a2d9
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,5 @@
+{
+ "printWidth": 120,
+ "singleQuote": true,
+ "trailingComma": "all"
+}
diff --git a/docs/hello-multiple/api.go b/docs/hello-multiple/api.go
new file mode 100644
index 0000000..0a28937
--- /dev/null
+++ b/docs/hello-multiple/api.go
@@ -0,0 +1,27 @@
+package main
+
+import (
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "os"
+
+ wasmhttp "github.com/nlepage/go-wasm-http-server/v2"
+)
+
+var binaryName = ""
+
+func main() {
+ http.HandleFunc("/hello", func(res http.ResponseWriter, req *http.Request) {
+ res.Header().Add("Content-Type", "application/json")
+ if err := json.NewEncoder(res).Encode(map[string]string{
+ "message": fmt.Sprintf("Hello from %s at path %s", binaryName, os.Getenv("WASM_HTTP_PATH")),
+ }); err != nil {
+ panic(err)
+ }
+ })
+
+ wasmhttp.Serve(nil)
+
+ select {}
+}
diff --git a/docs/hello-multiple/api1.wasm b/docs/hello-multiple/api1.wasm
new file mode 100755
index 0000000..73bb187
Binary files /dev/null and b/docs/hello-multiple/api1.wasm differ
diff --git a/docs/hello-multiple/api2.wasm b/docs/hello-multiple/api2.wasm
new file mode 100755
index 0000000..10cd874
Binary files /dev/null and b/docs/hello-multiple/api2.wasm differ
diff --git a/docs/hello-multiple/build.sh b/docs/hello-multiple/build.sh
new file mode 100755
index 0000000..495801a
--- /dev/null
+++ b/docs/hello-multiple/build.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+GOOS=js GOARCH=wasm go build -o api1.wasm --ldflags="-X 'main.binaryName=api1.wasm'" .
+GOOS=js GOARCH=wasm go build -o api2.wasm --ldflags="-X 'main.binaryName=api2.wasm'" .
diff --git a/docs/hello-multiple/index.html b/docs/hello-multiple/index.html
new file mode 100644
index 0000000..6d3fec4
--- /dev/null
+++ b/docs/hello-multiple/index.html
@@ -0,0 +1,29 @@
+
+
+
+ go-wasm-http-server hello demo
+
+
+
+
+
+
+
diff --git a/docs/hello-multiple/sw.js b/docs/hello-multiple/sw.js
new file mode 100644
index 0000000..9baf478
--- /dev/null
+++ b/docs/hello-multiple/sw.js
@@ -0,0 +1,15 @@
+importScripts('https://cdn.jsdelivr.net/gh/golang/go@go1.25.1/lib/wasm/wasm_exec.js');
+importScripts('https://cdn.jsdelivr.net/gh/nlepage/go-wasm-http-server@master/sw.js');
+
+addEventListener('install', (event) => {
+ event.waitUntil(caches.open('examples').then((cache) => cache.addAll(['api1.wasm', 'api2.wasm'])));
+});
+
+addEventListener('activate', (event) => {
+ event.waitUntil(clients.claim());
+});
+
+registerWasmHTTPListener('api1.wasm', { base: 'api1/1/' });
+registerWasmHTTPListener('api1.wasm', { base: 'api1/2/' });
+registerWasmHTTPListener('api2.wasm', { base: 'api2/1/' });
+registerWasmHTTPListener('api2.wasm', { base: 'api2/2/' });
diff --git a/docs/hello-sse/api.wasm b/docs/hello-sse/api.wasm
index 0b408ab..4092a6a 100755
Binary files a/docs/hello-sse/api.wasm and b/docs/hello-sse/api.wasm differ
diff --git a/docs/hello-sse/index.html b/docs/hello-sse/index.html
index f0831d5..abb58ee 100644
--- a/docs/hello-sse/index.html
+++ b/docs/hello-sse/index.html
@@ -3,47 +3,46 @@
go-wasm-http-server hello sse demo
diff --git a/docs/hello-sse/sw.js b/docs/hello-sse/sw.js
index b883512..9880758 100644
--- a/docs/hello-sse/sw.js
+++ b/docs/hello-sse/sw.js
@@ -1,14 +1,14 @@
-importScripts('https://cdn.jsdelivr.net/gh/golang/go@go1.23.1/misc/wasm/wasm_exec.js')
-importScripts('https://cdn.jsdelivr.net/gh/nlepage/go-wasm-http-server@v2.2.1/sw.js')
+importScripts('https://cdn.jsdelivr.net/gh/golang/go@go1.25.1/lib/wasm/wasm_exec.js');
+importScripts('https://cdn.jsdelivr.net/gh/nlepage/go-wasm-http-server@master/sw.js');
-const wasm = 'api.wasm'
+const wasm = 'api.wasm';
addEventListener('install', (event) => {
- event.waitUntil(caches.open('examples').then((cache) => cache.add(wasm)))
-})
+ event.waitUntil(caches.open('examples').then((cache) => cache.add(wasm)));
+});
addEventListener('activate', (event) => {
- event.waitUntil(clients.claim())
-})
+ event.waitUntil(clients.claim());
+});
-registerWasmHTTPListener(wasm, { base: 'api' })
+registerWasmHTTPListener(wasm, { base: 'api' });
diff --git a/docs/hello-state-keepalive/index.html b/docs/hello-state-keepalive/index.html
index 53985c5..0dd7f54 100644
--- a/docs/hello-state-keepalive/index.html
+++ b/docs/hello-state-keepalive/index.html
@@ -3,30 +3,30 @@
go-wasm-http-server hello with state and keepalive demo
-
+
diff --git a/docs/hello-state-keepalive/sw.js b/docs/hello-state-keepalive/sw.js
index 4d8e820..81d774d 100644
--- a/docs/hello-state-keepalive/sw.js
+++ b/docs/hello-state-keepalive/sw.js
@@ -1,16 +1,16 @@
-importScripts('https://cdn.jsdelivr.net/gh/golang/go@go1.23.1/misc/wasm/wasm_exec.js')
-importScripts('../sw.js')
+importScripts('https://cdn.jsdelivr.net/gh/golang/go@go1.25.1/lib/wasm/wasm_exec.js');
+importScripts('https://cdn.jsdelivr.net/gh/nlepage/go-wasm-http-server@master/sw.js');
-const wasm = '../hello-state/api.wasm'
+const wasm = '../hello-state/api.wasm';
-addEventListener('install', event => {
- event.waitUntil(caches.open('hello-state').then((cache) => cache.add(wasm)))
-})
-
-addEventListener('activate', event => {
- event.waitUntil(clients.claim())
-})
+addEventListener('install', (event) => {
+ event.waitUntil(caches.open('examples').then((cache) => cache.add(wasm)));
+});
-addEventListener('message', () => {})
+addEventListener('activate', (event) => {
+ event.waitUntil(clients.claim());
+});
-registerWasmHTTPListener(wasm, { base: 'api' })
+addEventListener('message', () => {});
+
+registerWasmHTTPListener(wasm, { base: 'api' });
diff --git a/docs/hello-state/api.wasm b/docs/hello-state/api.wasm
index b5787fe..719a7a3 100755
Binary files a/docs/hello-state/api.wasm and b/docs/hello-state/api.wasm differ
diff --git a/docs/hello-state/index.html b/docs/hello-state/index.html
index 7a2fc69..20c7bff 100644
--- a/docs/hello-state/index.html
+++ b/docs/hello-state/index.html
@@ -3,27 +3,27 @@
go-wasm-http-server hello with state demo
-
+