duyenho / example-create-react-app-express

Example on using create-react-app with a Node Express Backend

Home Page:https://esausilva.com/2017/11/14/how-to-use-create-react-app-with-a-node-express-backend-api/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

create-react-app React Project with Node Express Backend

Example on using create-react-app with a Node Express Backend

Usage

Install nodemon globally

npm i nodemon -g

Install server and client dependencies

yarn
cd client
yarn

To start the server and client at the same time (from the root of the project)

yarn dev

How this works

The key to use an Express backend with a project created with create-react-app is on using a proxy. We have a proxy entry in client/package.json

"proxy": "http://localhost:5000/"

This tells Webpack development server to proxy our API requests to our API server, given that our Express server is running on localhost:5000

Tutorial

Visit my blog post entry for a detailed step-by-step guide.

Giving Back

If you would like to support my work and the time I put in making tutorials, you can click the image below to get me a coffee. I would really appreciate it (but is not required).

Buy Me A Coffee

-Esau

About

Example on using create-react-app with a Node Express Backend

https://esausilva.com/2017/11/14/how-to-use-create-react-app-with-a-node-express-backend-api/

License:MIT License


Languages

Language:JavaScript 73.4%Language:HTML 20.9%Language:CSS 5.8%