DEV Community

Discussion on: FullStack setup (Node.js, React.js and MongoDB)

Collapse
 
ernyx profile image
Alg Ore

Great guide, thank you!

Question, any idea why the proxy breaks when using a api url more than two levels deep? "/api/blocks" works whereas "/api/blocks/all" does not. Everything else is the same and api routes work separately.

Tried "/api" and "/api/**" in setupProxy.js to no avail.

Collapse
 
pacheco profile image
Thiago Pacheco

Hi Alg, sorry for the delayed answer and thank you for your comment.

This deep routes should work as the other ones. What I recommend to you is to use the proxy config that react supports now.
You can simply put the following line in your package.json file:
"proxy": "localhost:5000"

This should do the trick.

Let me know if that works for you!