capsule-hello-post

command module
v0.0.0-...-d76bbf2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2023 License: MIT Imports: 3 Imported by: 0

README ΒΆ

Capsule hello

This wasm module is used by the http mode

Build the wasm module

tinygo build -o hello.wasm -scheduler=none -target wasi ./hello.go

Load (and run) the wasm file module from a local path

export MESSAGE="πŸ’Š Capsule Rocks πŸš€"
./capsule \
   -wasm=./hello.wasm \
   -mode=http \
   -httpPort=7070

Then call the wasm function:

curl -v -X POST \
  http://localhost:7070 \
  -H 'content-type: application/json; charset=utf-8' \
  -d '{"message": "Golang πŸ’š wasm", "author": "Philippe"}'

Load (and run) the wasm file module from an URL

First serve the wasm file:

python3 -m http.server 8080

Then load and serve the module: (the wasm file is the output of the download file)

export MESSAGE="πŸ’Š Capsule Rocks πŸš€"
./capsule \
   -wasm=./tmp/hello.wasm \
   -url="http://localhost:8080/hello.wasm" \
   -mode=http \
   -httpPort=7070

Then call the wasm function:

curl -v -X POST \
  http://localhost:7070 \
  -H 'content-type: application/json; charset=utf-8' \
  -d '{"message": "Golang πŸ’š wasm", "author": "Philippe"}'

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL