Typescript HTTP Streaming
This repository contains a HTTP component that performs a streaming response using WASI I/O and HTTP Preview2 primitives, written in Typescript.
This component:
- Uses Typescript for it's implementation
 - Uses the 
wasi:httpandwasi:iostandard WIT definitions - Relies on the 
httpservercapability provider (which exposes thewasmcloud:httpserverinterface) - Streams bytes in response to all HTTP requests
 - Can be declaratively provisioned with 
wadm 
Dependencies
![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 | Wasmcloud Shell controls your [wasmcloud][wasmcloud] host instances and enables building components (version should be >= 0.39.0) | 
npm | Node Package Manager (NPM) which manages packages for for the NodeJS ecosystem | 
node | [NodeJS runtime][nodejs] (see .nvmrc for version) | 
Quickstart
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) - Builds a declarative WADM manifest consisting of:
- Your locally built component
 - A HTTP server provider which will receive requests from the outside world (on port 8000 by default)
 - Necessary links between providers and your component so your component can handle web traffic
 
 - Deploys the built manifest (i.e all dependencies to run this application) locally
 - Watches your code for changes and re-deploys when necessary.
 
[!NOTE] To do things more manually, see
docs/slow-start.md.
Send a request to the running component
Once wash dev is serving your component, to send a request to the running component (via the HTTP server provider):
curl localhost:8000Adding Capabilities
To learn how to extend this example with additional capabilities, see the Adding Capabilities section of the wasmCloud documentation.