Creating Isomorphic Apps with Node.js, React, and Express
Over the past few years, the Web community has been abuzz with “isomorphic apps”. They are apps where the markup is rendered on the server and fed to the browser as complete HTML, and the successive user interactions are handled by client side rendering. This is useful as it lead to outcomes like faster page loading, better search engine indexing, and better user experience. In this tutorial, we’ll crate a simple isomorphic app that uses Node, React, and Express to understand the underlying process behind it.
The Tech Stack
In this article, we’re going to use following software:
- React: the UI framework that can rendered on both server and client.
- Express: the application server framework for Node.js.
- react-router: the routing solution specially developed for React.js.
Let’s start the project by upgrading to Node v.0.12.6 and creating an empty directory that will act as our project folder. Once done, run the
npm init command in the newly created directory and fill up the presented questions. The next thing we need to do is to install all the required packages. Execute the following command to achieve this task:
$ npm install --save-dev babel babel-loader express jade react react-hot-loader react-router webpack webpack-dev-sever nodemon
When the installation process is completed, we have to create a
src folder inside our project folder. Then, we have to create the following directories inside
server: where the backend Node.js server and webpack dev server will reside.
client: this will be the entry point to handle React bundle.
shared: this folder will hold app’s components, flux, routes, etc.
Continue reading %Creating Isomorphic Apps with Node.js, React, and Express%