This actor makes use of a single capability, wasmcloud:httpserver, in order to receive HTTP requests and respond with the classic "Hello, World!".
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
wash build. - Run the wasmCloud host with
wash up - In your browser at
localhost:4000, in the Actors table, use the dropdown to start the actor From File and select the built and signed module from step 1 - Start the HTTP server provider From Registry with OCI reference
wasmcloud.azurecr.io/httpserver:0.17.0 - Link your hello actor to the HTTP server provider with a link value of
address=0.0.0.0:8080 curl localhost:8080to see your response, or follow the browser instructions below
Visit the url "http://localhost:8000" to see your response in the browser.
- You can change what contracts this actor claims in
wasmcloud.tomland theMakefile. In the future this will just be inwasmcloud.toml. - You will then need to change the dependencies in
Cargo.tomlto import the interfaces for the contracts you want. Delete thewasmcloud-interface-httpserverdep if you're not using that contract. - Finally, change the
src/lib.rsfile, changing/deleting the current interface import andimplblock, while adding a new import &implfor any contracts you added!
The generated project include two GitHub 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 characterSeedvalueWASH_SUBJECT_KEY, which can be generated withwash keys gen module, then look for the 58 characterSeedvalueWASMCLOUD_PAT, which can be created by following the Github PAT instructions and ensuring thewrite:packagespermission is enabled