terrarium-browser-host
v0.0.2
Published
This package enables us to run a WASM instance for Fastly Terrarium on a browser.
Downloads
2
Readme
Terrarium Browser Host
Terrarium Browser Host can execute a WASM instance for Fastly Terrarium on a browser.
Using this library and Fastly Terrarium, we might be able to realize universal app(SSR) with only one WASM instance!
Install
npm install terrarium-browser-host
Execute a WASM instance for Terrarium
import TerrariumHost from 'terrarium-browser-host'
const host = await TerrariumHost.instantiate('./terrarium.wasm')
const response = host.run({
method: 'POST',
path: '/some-entrypoint',
headers: {
'Content-type': ['text/html']
},
body: 'test-body'
})
console.log(response)
// {
// code: 200,
// headers: {
// "content-type": ["text/html"]
// },
// body: "..."
// }
Development
Watch
npm run dev
Build
npm run build