# Using Express with create-react-app | Voting App

**URL:** <https://forum.freecodecamp.org/t/using-express-with-create-react-app-voting-app/95488>\
**Category:** General\
**Created:** [March 10, 2017, 8:53pm UTC](https://forum.freecodecamp.org/t/using-express-with-create-react-app-voting-app/95488 "2017-03-10T20:53:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rpemberton](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@rpemberton](https://forum.freecodecamp.org/u/rpemberton)\
**Post date:** [March 10, 2017, 8:53pm UTC](https://forum.freecodecamp.org/t/using-express-with-create-react-app-voting-app/95488/1 "2017-03-10T20:53:10Z")

</div>

Hi all,

I’m just beginning the Build a Voting App challenge in the Back End Development projects and I’m having a lot of difficulty figuring how to use Express with `create-react-app`. The goal I have in mind is for express to serve the React app when I run `npm start`.

I feel like this may be the solution but I don’t really understand it: [https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#proxying-api-requests-in-development](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#proxying-api-requests-in-development)

Does anybody have experience of using Express with create-react-app in development?

Thanks  
Rob

---

<div class="post-metadata">

**Author:** ![JohnnyBizzel](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/johnnybizzel/32/37661_2.png) [@JohnnyBizzel](https://forum.freecodecamp.org/u/JohnnyBizzel)\
**Post date:** [March 10, 2017, 10:27pm UTC](https://forum.freecodecamp.org/t/using-express-with-create-react-app-voting-app/95488/2 "2017-03-10T22:27:54Z")

</div>

I got half way through Voting app before parking it and moving on to other things.

Having said that, we got the app working with React and Node using Express.

```auto
app.use('/', index);
app.use('/api', api);
app.use('/user', user);
app.use('/Polldetailfull/:id', index);
app.use('/editthepoll/:id', index);

```

If you look at the app.js file [https://github.com/JohnnyBizzel/voting-app/blob/no-auth0/app.js](https://github.com/JohnnyBizzel/voting-app/blob/no-auth0/app.js)  
I have set up routing so index goes to the React index file.  
/api goes to any API calls  
/user is not currently used  
and the other 2 routes are use for refreshes of these routes.  
We also used React Routing.

More routing code is found here in `index.js`:

> <https://github.com/JohnnyBizzel/voting-app/blob/no-auth0/routes/index.js>

That’s not using “Create React App” but I hope this info helps.

---

<div class="post-metadata">

**Author:** ![bhefty](https://avatars.discourse-cdn.com/v4/letter/b/ee7513/32.png) [@bhefty](https://forum.freecodecamp.org/u/bhefty)\
**Post date:** [March 11, 2017, 4:31am UTC](https://forum.freecodecamp.org/t/using-express-with-create-react-app-voting-app/95488/3 "2017-03-11T04:31:41Z")

</div>

I used React-Router for the user accessible pages (public facing) and Express for the backend API. I ended up using a proxy and essentially running two concurrent processes, as detailed here:

[https://www.fullstackreact.com/articles/using-create-react-app-with-a-server/](https://www.fullstackreact.com/articles/using-create-react-app-with-a-server/)

As a side note for deployment, I used the buildpack described here:

[https://github.com/mars/create-react-app-buildpack](https://github.com/mars/create-react-app-buildpack)

---

<div class="post-metadata">

**Author:** ![rpemberton](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@rpemberton](https://forum.freecodecamp.org/u/rpemberton)\
**Post date:** [March 11, 2017, 10:14am UTC](https://forum.freecodecamp.org/t/using-express-with-create-react-app-voting-app/95488/4 "2017-03-11T10:14:26Z")

</div>

Thanks bhefty, from the link you posted I discovered this:

> **[mars/heroku-cra-node](https://github.com/mars/heroku-cra-node)**
>
> heroku-cra-node - How to use create-react-app with a custom Node server on Heroku

… which at first glance seems to be a minimal boilerplate for setting up express with create-react-app. Hopefully just the thing to get me started 🙂

---

<div class="post-metadata">

**Author:** ![bhefty](https://avatars.discourse-cdn.com/v4/letter/b/ee7513/32.png) [@bhefty](https://forum.freecodecamp.org/u/bhefty)\
**Post date:** [March 11, 2017, 3:15pm UTC](https://forum.freecodecamp.org/t/using-express-with-create-react-app-voting-app/95488/5 "2017-03-11T15:15:59Z")

</div>

Awesome find! Thanks for sharing, I think I may use this as well now.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 16, 2021, 5:59pm UTC](https://forum.freecodecamp.org/t/using-express-with-create-react-app-voting-app/95488/6 "2021-01-16T17:59:07Z")

</div>


