r/reactjs • • May 03 '18

Beginner's Thread / Easy Question (May 2018)

Pretty happy to see these threads getting a lot of comments - we had over 200 comments in last month's thread! If you didn't get a response there, please ask again here!

Soo... Got questions about React or anything else in its ecosystem? Stuck making progress on your app? Ask away! We’re a friendly bunch. No question is too simple.

The Reactiflux chat channels on Discord are another great place to ask for help as well.

25 Upvotes

267 comments sorted by

View all comments

Show parent comment

4

u/splendidG00se May 25 '18

For deploying your php app, you can use something like heroku to get started: https://devcenter.heroku.com/articles/getting-started-with-php#introduction

For your react app, i’d recommend using now: https://zeit.co/now

In your php responses, you’ll need to include a “access-control-allow-origin” header that whitelists your react app domain (or just * to make it easy)

In your react app, you should have a “API_URL” constant somewhere that you can use across your app. That way you can swap between “localhost:5000” (or whatever port your php backend is running locally) and “http://your-php-production-url.com” when it’s running in production.

1

u/gemanepa May 25 '18

Jesus, you are a golden god walking among humans, do you realize that? Thanks a lot A LOT