How to install a separate React app in an existing Express app

Stephan Bakkelund Valois
5 min readSep 11, 2020

Table of Contents

Source code https://github.com/Devalo/react-app-in-existing-express-app

Why?

There are times when a simple Express app serving HTML is a very easy and efficient way to build a website. With all the different NPM packages out there, and a nice Bootstrap theme, you can build a nice website in Express just as fast as any Wordpress site.

Now, imagine you’ve built a website. For ease of use, you went with Express. Express makes it easy to create server side rendered pages, since the that’s what a back end server does — serves HTML or JSON to a client.

Say you need a dashboard to control certain (or all) elements of your server rendered app. The dashboard wouldn’t need any SEO, so that’s nothing to worry about. What would be cool is two separate apps, running simultaneously on the same port, melted into one app.

So how do you install a separate React app in your Express app? If you follow the React documentation, you’ll get a weird build that needs a bunch of…

--

--