rawhat / mist

gleam HTTP server. because it glistens on a web
Apache License 2.0
333 stars 12 forks source link

JavaScript target #26

Closed MystPi closed 1 year ago

MystPi commented 1 year ago

I'm not sure how feasible this would be, but adding the JavaScript target support to mist would be amazing and very appreciated. Other libraries (like wisp) depend on mist, and since mist does not support a JavaScript target, they do not support a JavaScript target either. Anyway, not sure how feasible this would be, but it is something to think about! I am willing to help with this, though I don't know much about Erlang.

rawhat commented 1 year ago

Unfortunately, I don't really think this is going to be feasible. The concurrency on each platform is completely different, and integrating them would not be possible. You'd definitely want to be able to await somePromise in your handlers in JavaScript, but that would change the function signature(s) to something incompatible with Erlang.

Both currently supported JS runtimes do have web servers built in though, so getting something somewhat similar to this library as a separate package / FFI module in your project would be easy. Much easier than this implementation :)

Appreciate the interest though!