0.0.2 • Published 4 years ago

terrarium-browser-host v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

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