React renderToReadableStream
- Dominant language
- Rust
- Stars
- 8.8k
- Forks
- 393
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 45
Description
I'm trying to figure out how to create a simple Rust HTTP backend and implement server-side rendering in it. Currently, I'm just calling code that returns HTML as follows:
This is a snippet from my javascript code which is executed using rquickjs and llrt modules:
```js
const handler = async () => {
const app = ReactDOMServer.renderToString(React.createElement());
const html = `
return html;
};
```
I don't think this is ideal for handling high traffic because I'm seeing strange errors from QuickJS, which I assume are due to the cost of `renderToString`. I'm wondering if exposing the `ReadableStream` struct from the `web-stream `module would allow me to leverage streaming in Rust and serve responses directly from my Rust HTTP application.
What do you think? What are the possible solutions for achieving this? Or am I completely off-track in my approach to SSR using the` web-stream` module in a Rust HTTP server?
Contributor guide
Research direction
Start by reviewing the rquickjs and llrt module usage around ReactDOMServer.renderToString and the web-stream module mentioned in the issue. Determine whether exposing ReadableStream would let a Rust HTTP application serve streamed SSR responses, and document the supported approach or the missing requirements.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react, rust
- Domain
- backend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100