create-react-app-express
v1.1.1
Published
Express server for your Create React App, ready for SSR
Downloads
6
Maintainers
Readme
Create React App Express
Express server for your Create React App projects featuring server-side rendering.
Please visit Create React App Universal CLI for the usage.
How it works
- In development mode, the middleware will try to proxy into the CRA client to get the required
index.html
, and then proceed to render on the server - By default, the middleware will try to use default CRA client port (3000), and you can change it using
CRA_CLIENT_PORT
env variable - In production mode, the middleware will get the
index.html
from your CRA client build
Public exports
const { createReactAppExpress, handleUniversalRender } = require('create-react-app-express');
const { staticLoader, universalLoader } = require('create-react-app-express/lib/loaders');
// Most basic SSR will use the first exports, the second one will be used by existing express project or further customization
Credits
- Based on https://github.com/ayroblu/ssr-create-react-app-v2
License
MIT