/cra_ssr

create-react-app with server side rendering without using eject

Primary LanguageJavaScript

cra_ssr Create React App with Server Side Rendering

create-react-app with Advanced server side rendering without ejecting npm run eject

This project was bootstrapped with Create React App.

You can find the most recent version of create-react-app guide here where you can find some information on how to perform common tasks.

Routing

we will be using React Router V4 .

Store

we will be using Redux for managing Store , if you want to use Mobx you will have to update the config a little bit

for debugging redux install Redux Devtools Extension.

Server

we will be using Express you are free to use any other Node js server like KOA or even Go or another language you just need to change the config ;)

we will be using the server mainly for rendering React to Html if you are not requesting data from server asynchronously you can skip the endpoint setSetate

Test

we will be using Jest

Start Project

because the subject of this repository is to add SSR on top of create-react-app you can still benefit from all CRA functionality

$ yarn start
$ yarn build
$ yarn test 
$ yarn eject

the SSR functionally are ensure through ExpressJS server in Development environment

    $ yarn serve
    //or 
    $ npm run serve 

serve will Start you project , you need to keep on mind that each time you make a change you have to restart the server.

you can skip restarting the server if you change something in /server using nodemon

    $ nodemon servre 

But if you change something in React (/src) you will have to restart the server because to build the project , you can add a watcher over all changes and restart the build each time (i am just lazy to do it xD).

####Production environment

CRA ensure the best build for your app , of course you are free to add any more config you like , then Express will serve you Data

    $ yarn deploy
    //or 
    $ npm run deploy

Project Structure