| Audience | Software engineers who are familiar with WebAssembly and have a conceptual understanding of the WebAssembly Component Model. Code in this article will be written in Rust but you don’t need to be familiar with it to follow along. |
|---|---|
| Purpose | The purpose of this article is to guide you through the creation of a simple Wasm HTTP component. |
| Motivation | I wrote this article because I struggled to find resources on how to write HTTP services using Wasm components and the Wasmtime CLI. |
****By the end of this article you will :
This article assumes you have:
write:packages and read:packages scopesThe wasm32-wasip2 target makes it possible for the Rust compiler to directly compile projects to the Wasm Components format.
rustup target add wasm32-wasip2
Our Wasm component will handle requests through Wasmtime's built-in HTTP server.
curl https://Wasmtime.dev/install.sh -sSf | bash
wkg is a suite of tools we are going to use to fetch dependencies and package our component.
cargo install wkg
cargo-expand (optional) prints fully expanded code, including generated bindings.