This project implements an actor that returns a greeting.
Upon receiving an http request, the actor returns "Hello World". The response can be customized by adding an http query parameter 'name'. For example, if the http server is running on localhost port 8000, the command
curl "localhost:8000/?name=Alice"
returns "Hello Alice".
To respond to http requests, the actor must implement the
httpResponse
method of the
HttpServer interface interface.
The implementation is in the file src/lib.rs
- To compile the actor and generate a signed Webassembly module, type
make
. - To load and start the actor you'll need to have a running OCI-compatible
registry. Check that
REG_URL
setting in Makefile is correct, and runmake push
andmake start
to push the actor to the registry and start the actor. Alternately, you can load and start the actor from the host's web ui. When prompted for the path, selectbuild/verbalcode_s.wasm
.
The actor must be linked with an HttpServer capability
provider with the contract id wasmcloud:httpserver
. You can start the
provider (TODO: need registry url and more specific instructions here)
Your actor can be invoked from a terminal command-line or from a web browser. The following examples assume the http server is listening on localhost port 8000.
curl localhost:8000
curl "localhost:8000/?name=Alice"
(note the quotes in the second example)
visit the url "http://localhost:8000" or "http://localhost:8000/?name=Alice"
If you store your source code on Github, we've gone ahead and included two actions: build.yml
and release.yml
under .github/workflows
. The build action will automatically build, lint, and check formatting for your actor. The release action will automatically release a new version of your actor whenever code is pushed to main
, or when you push a tag with the form vX.Y.Z
.
These actions require 3 secrets
WASH_ISSUER_KEY
, which can be generated withwash keys gen issuer
, then look for the 58 characterSeed
valueWASH_SUBJECT_KEY
, which can be generated withwash keys gen module
, then look for the 58 characterSeed
valueWASMCLOUD_PAT
, which can be created by following the Github PAT instructions and ensuring thewrite:packages
permission is enabled