2
2
3
3
This wasm module is used by the ` http ` mode
4
4
5
- ## Load (and run) the wasm file module from a local path
5
+ ## Build the wasm module
6
6
7
7
``` bash
8
- cd ../../capsulelauncher
8
+ tinygo build -o hello.wasm -scheduler=none -target wasi ./hello.go
9
+ ```
10
+
11
+ ## Load (and run) the wasm file module from a local path
9
12
10
- export MESSAGE= " 💊 Capsule Rocks 🚀 "
11
- go run main.go \
12
- -wasm=../wasm_modules/capsule-hello /hello.wasm \
13
+ ``` bash
14
+ ./capsule \
15
+ -wasm=./hello.wasm \
13
16
-mode=http \
14
17
-httpPort=7070
15
18
```
16
19
17
20
Then call the wasm function:
18
21
``` bash
19
- curl -v -X POST \
20
- http://localhost:7070 \
21
- -H ' content-type: application/json; charset=utf-8' \
22
- -d ' {"message": "Golang 💚 wasm", "author": "Philippe"}'
22
+ curl -v http://localhost:7070
23
23
```
24
24
25
- ## Load (and run) the wasm file module from an URL
25
+ ## Load (and run) the wasm file module from a URL
26
26
27
27
First serve the wasm file:
28
28
``` bash
@@ -31,10 +31,7 @@ python3 -m http.server 8080
31
31
32
32
Then load and serve the module: * (the ` wasm ` file is the output of the download file)*
33
33
``` bash
34
- cd ../../capsulelauncher
35
-
36
- export MESSAGE=" 💊 Capsule Rocks 🚀"
37
- go run main.go \
34
+ ./capsule \
38
35
-wasm=./tmp/hello.wasm \
39
36
-url=" http://localhost:8080/hello.wasm" \
40
37
-mode=http \
@@ -43,8 +40,5 @@ go run main.go \
43
40
44
41
Then call the wasm function:
45
42
``` bash
46
- curl -v -X POST \
47
- http://localhost:7070 \
48
- -H ' content-type: application/json; charset=utf-8' \
49
- -d ' {"message": "Golang 💚 wasm", "author": "Philippe"}'
43
+ curl -v http://localhost:7070
50
44
```
0 commit comments