(res, returnValue)
| 30 | const moduleBasePath = new URL('../src', url.pathToFileURL(__filename)).href; |
| 31 | |
| 32 | async function renderApp(res, returnValue) { |
| 33 | const {renderToPipeableStream} = await import('react-server-dom-esm/server'); |
| 34 | const m = await import('../src/App.js'); |
| 35 | |
| 36 | const App = m.default; |
| 37 | const root = React.createElement(App); |
| 38 | // For client-invoked server actions we refresh the tree and return a return value. |
| 39 | const payload = returnValue ? {returnValue, root} : root; |
| 40 | const {pipe} = renderToPipeableStream(payload, moduleBasePath); |
| 41 | pipe(res); |
| 42 | } |
| 43 | |
| 44 | app.get('/', async function (req, res) { |
| 45 | await renderApp(res, null); |
no test coverage detected