This repository contains an HTTP component that performs a streaming response using WASI I/O and HTTP primitives, written in TypeScript.
This component:
- Uses Typescript for its implementation
- Uses the
wasi:httpandwasi:iostandard WIT definitions - Streams 1MiB of random bytes in response to all HTTP requests
![WARN] When building this project, ensure you are using a stable NodeJS release.
Use of node version management tools (ex.
nvmor more newer NVM compatible tools likefnm) are recommended -- a.nvmrcfile is included for easy use.
Building this project relies on the following software:
| Name | Description |
|---|---|
wash |
Wasm Shell controls your [wasmCloud][wasmcloud] host instances and enables building components (version >= 2.0) |
npm |
Node Package Manager (NPM) which manages packages for the NodeJS ecosystem |
node |
[NodeJS runtime][nodejs] (see .nvmrc for version) |
To get started developing this repository quickly, clone the repo and run wash dev:
wash devwash dev does many things for you:
- Starts the wasmCloud host that can run your WebAssembly component
- Builds this project (including necessary
npmscript targets) - Deploys an HTTP server on port 8000 and links it to your component
- Watches your code for changes and re-deploys when necessary
Once wash dev is serving your component, to send a request to the running component (via the HTTP server provider):
curl localhost:8000To learn how to extend this example with additional capabilities, see the TypeScript Language Guide in the wasmCloud documentation.