Render app to stream
import express from 'express'import {renderToStream} from '@rambler-tech/react-toolkit/server'import {routes} from './routes'const assets = require(process.env.RAZZLE_ASSETS_MANIFEST)const server = express()server .use(express.static(process.env.RAZZLE_PUBLIC_DIR)) .get('/*', async (req, res) => { try { const {css: styles, js: scripts} = assets.client await renderToStream({ req, res, routes, styles, scripts }) } catch (error) { console.error(error) } })export default server Copy
import express from 'express'import {renderToStream} from '@rambler-tech/react-toolkit/server'import {routes} from './routes'const assets = require(process.env.RAZZLE_ASSETS_MANIFEST)const server = express()server .use(express.static(process.env.RAZZLE_PUBLIC_DIR)) .get('/*', async (req, res) => { try { const {css: styles, js: scripts} = assets.client await renderToStream({ req, res, routes, styles, scripts }) } catch (error) { console.error(error) } })export default server
Generated using TypeDoc
Render app to stream