Menu

Speeding up your React Router server-side-rendered (SSR) app with Hono
📰

Speeding up your React Router server-side-rendered (SSR) app with Hono

DEV Community: react·Lucas Tonelli·14 days ago
#liZ1cfi1
#devtoreact#devto#dev#server#hono
Reading 0:00
15s threshold

If you're running a React Router app in framework mode, you get SSR out of the box and for production it hands you @react-router/serve, a small server built on top of Express. While it does the job, Express carries a bit of history (and weight) with it, so if you're the kind of person who wants a leaner server, or just more control over what happens around your app, there's a really nice alternative that drops in with almost no glue.

Hono (and its Node server)

The createRequestHandler from react-router gives you a function that takes a standard web Request and resolves to a standard web Response , that's the whole contract. It doesn't care about Node, Express, or any particular server, it just wants a Request and it'll give you back a Response .

Hono is built on those exact same web standards and, inside its handler, context.req.raw is already a web Request .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.