Server side rendering with create-react-app
Steps to reproduce
These are the steps to reproduce this app.
<your-repo-url> with your values.
create-react-app <your-app-name> cd <your-app-name> touch src/server.js # You can copy src/server.js in this repository git add . git commit -m "Enable ssr" git remote add origin git@<your-repo-url> git push -u origin master
- Login to app.stormkit.io
- Create a new app and connect the repository pushed above.
- Select production environment and edit it with the following values:
|Entry||src/server.js||The server side entry file. The path is relative to project root.|
|Dist folder||build||The public folder which contains build artifacts.|
|Build command||yarn build||The client side build command.|
|Environment variables||NODE_ENV=production||The environment variables that will be passed both to client side and server side.|
If you don't need server side rendering, simply leave the
Entry configuration empty. This way your files will be automatically served from CDN and no server invocation will be made.