Implementing a server side rendering app with React + Redux + Redux-saga + Express + Webpack.
-
server is responsible for rendering initial html.
-
serve js bundle as public, leave the rendering to frontend.
yarn install
npm run dev
. request localhost:3005
in your browser.
npm run build:prod
npm run start:local
. request localhost:3005
in your browser.
json-server use this to serve fake data to frontend. It host's a node server with basic RESTful routes.
here is how I will be using for seperating environment configuration.
I choose to use google material-ui as the generic design for the app.
Production
NODE_ENV=production npm run start
Developement
NODE_ENV=development npm run dev
Configuration
const config = () => {
switch(this.process.NODE_ENV):
case 'production':
return {prod config}
default:
return {dev config}
}
export default config()
I choose i18next and react-i18next after sometimes surveying other alteratives.