reactjs / react-tutorial

Code from the React tutorial.
http://facebook.github.io/react/docs/tutorial.html
Other
3.29k stars 2.13k forks source link

CORS permissive example server #118

Closed MaxBittker closed 8 years ago

MaxBittker commented 8 years ago

When following this tutorial, specifics about the different ways to set up ports/webpack/file serving/etc should tend towards "just working" and allow people to not get derailed. This PR sets the node.js example server to use lightweight middle-ware which sets HTTP headers to allow cross-origin requests. Anecdotally, I lost a chunk of time debugging this problem when I was running the comment api server on ::3000, and webpack-dev-server on ::8080. Could be worth setting the other servers to do the same. Thanks for this resource!

facebook-github-bot commented 8 years ago

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

facebook-github-bot commented 8 years ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

zpao commented 8 years ago

Do you know which header needed to be set? I think I'd rather we just set it explicitly, making it easier to update all the servers at once.

Typically I'd say meh about this whole PR since you've obviously stepped outside this tutorial to use webpack, but it's common enough these days and minimal effort so it's fine.

zpao commented 8 years ago

Closing since #120 exists.