0

I'm new in react world. So I want to make an website with express + react. My question is, I have to make 2 servers 1 to my cliente-side(react) and another to my server-side(express)?? or I can create just 1 server with both, like express + ejs, blade?

(Sorry for my english)

Thanks,

1
  • 1
    If you're just making a website then you don't need two servers. If you're creating an API to deliver data then it's generally recommended to keep your API self-contained in its own environment. This (among other things) allows you to guarantee that your API isn't muddled with any other concerns except what it needs to function. Commented Dec 31, 2017 at 2:31

2 Answers 2

1

You could use only one server if you wanted to. Setup your express server to return your react bundle on one url, all your api requests on other dedicated urls (same goes for static content such as images), and fall back to returning your index.html on all other urls.

Sign up to request clarification or add additional context in comments.

Comments

0

You can use one server by setting up react to use a proxy.

Read this awesome article. Link

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.