Create react app dev with Express

I have been banging my head against a very simple problem.

I am trying to get a react dev server working with expressjs so that I have a playground with a frontend and backend.

Glitch only exposes one port, by default 3000. This rules out making XHR requests to a different port from the frontend to the backend. The solution is to run create-react-app on port 8000 and setup a proxy from the express server to the frontend.[1] As suggested by a glitch employee [0].

However, the proxy I have made doesn’t seem to work. Surely this is such a common setup somebody has done this before?

[0] What's the port range users have at Glitch?
[1] https://glitch.com/edit/#!/stripe-react-elements-express

Hmmm…could you share the project? I’d be happy to take a look!

Linked above already. Here it is again https://glitch.com/edit/#!/stripe-react-elements-express

Eventually fixed it. A working version can be found here with some of the later features of babel etc https://glitch.com/edit/#!/express-create-react-app-starter

1 Like