ktock / container2wasm

Container to WASM converter

Home Page:https://ktock.github.io/container2wasm-demo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to setup HTTP server running inside container?

alienself opened this issue · comments

I would like to know how it would be possible to expose an HTTP server running inside the container to the outside page so that an iframe running on the same browser tab could potentially make a request to the container.

For instance let's say that my container is running nodejs with express like so:

const express = require('express')
const app = express()
const port = 3000

app.get('/', (req, res) => {
  res.send('Hello World!')
})

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`)
})

Is that something that is even possible without some sort of proxy server?
I would like to keep everything running locally.

an iframe running on the same browser tab could potentially make a request to the container.

This is not implemented as of now. If needed, it would be good to fix the networking stack (c2w-net-proxy) to add such feature, using additional fds maybe.

Seems like this enhancement would allow container2wasm to compete with the closed-source WebContainers project.