ReactJS, ExpressJS different application Architectures & Modeling and Deployments

557 Views Asked by At

I have gone through different blog articles to find out how a full-fledged application can be modeled and developed with React,Redux (working on front-end) with API end-points communicating with an ExpressJS server.

To my knowledge, we need to have:

a). One expressJS application developed with all possible end-points (available for an API access). This application should be running on a port e.g. 7070. This server side application will be communicating with the database.

b). Develop a React, Redux based application for front-end and run this application on a different port e.g. 8080 using webpack, gulp or grunt server.

I am sure this is not the only model. Or, maybe my concept is little weak. But this post will clarify concepts globally to all Frontend+fullstack developers. Please write your recommendations and expert opinions on followings:

  1. Is my defined model right?

  2. Is there a way, or possible to use ExpressJS application to throw a ReactJS application as one-page application (which process and render all defined React routes on client side).

    /* a reference example of using root route handler in Express to throw an index file (which includes bundle.js react application), this works okay, but can not handle or render React Routes on client side; and instead if a menu link clicked that sends request to Express but Express application file only had '/' route to handle. */

    app.get("/", function(req, res){ res.sendFile(dirname + "index.html"); // but this is not viable })

  3. If point#2 is possible then our application can run on same port right? And our application can also use Express routes as an API end-points. But I'm sure that will not be the recommended way or even possible; unless we do the server side rendering of React (in our server side ExpressJS application).

Deployment

Scenario: React+Redux+Express+DB (mongoDb, Redis, MySql or Postgres etc.) Full Stack application

  1. Online/Cloud Hosting
    Normally we are hosting our application on any 3rd party server (or cloud server). The normal shared hosting does not work unless they have NodeJS server. Most common are: Heroku, AWS, RedHat OpenShift, Nodejitsu, Microsoft Azure, Modulus, Firebase, etc. In this case most of the server side things are easy to setup and headache free.

  2. Local Network (Internal Company/Corporate Server) Hosting
    i). Linux Bases server (any version) + SSL installed + Required DB Installation + NodeJS installation + Dedicated IP
    ii). Windows Bases Server + SSL installed + Required DB Installation + NodeJS installation + Dedicated IP


Can anyone elaborate more on the internal server hosting setup procedure with all security measures in more details? I really do not know what each step that should be taken would be.
It will also be helpful if any technical person could write about application modeling as well. This will help everyone.

Note: The answers should be short in the question context (not in the question subject line context, which is quite broad). Any reference or links will be good to make answer quite short.

0

There are 0 best solutions below