Skip to content

[docs] Talk about running a server in tutorial #2824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 16, 2015

Conversation

zpao
Copy link
Member

@zpao zpao commented Jan 8, 2015

We've talked about this a few times and even half done it. This is for real.

I also changed the name of the html file to be index.html (that's what's in the tutorial repo)

See also #2004, #2739, #800 (eh, not totally but I want to close it), reactjs/react-tutorial#1 and surely some others.

@@ -379,7 +385,7 @@ When the component is first created, we want to GET some JSON from the server an

We'll use jQuery to help make an asynchronous request to the server.

Note: because this is becoming an AJAX application you'll need to develop your app using a web server rather than as a file sitting on your file system. The easiest way to do this is to run `python -m SimpleHTTPServer` in your application's directory.
Note: because this is becoming an AJAX application you'll need to develop your app using a web server rather than as a file sitting on your file system. [As mentioned above](#running-a-server), we have provided serveral servers you can use [on GitHub](https://github.com/reactjs/react-tutorial/). The provide the functionality you need for the rest of this tutorial.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The provide" typo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, fixed.

We've talked about this a few times and even half done it. This is for
real.
@zpao
Copy link
Member Author

zpao commented Jan 16, 2015

Anybody have objections? @spicyj?

@sophiebits
Copy link
Collaborator

Seems reasonable. Did you test that loading the first parts from a file: URL works properly in Firefox and Chrome and Safari? I imagine it would since we're not doing anything fancy but it can't hurt to check.

zpao added a commit that referenced this pull request Jan 16, 2015
[docs] Talk about running a server in tutorial
@zpao zpao merged commit 69d40d1 into facebook:master Jan 16, 2015
zpao added a commit that referenced this pull request Jan 17, 2015
[docs] Talk about running a server in tutorial
zpao added a commit that referenced this pull request Jan 17, 2015
@brigand
Copy link
Contributor

brigand commented Jan 18, 2015

Awesome, there's been a few stackoverflow questions about this.

But I'd much rather see '/api/comments' than 'comments.json', which indicates a static file – this confused me when going through the tutorial initially.

Aside from that, I've noticed a lot of people taking the tutorial as 'the way things are done', so not sure how to clarify this, but some mention of moving the $.ajax call outside of the component would be nice. Possibly introducing a mixin for async data fetching using $.ajax.

@zpao
Copy link
Member Author

zpao commented Jan 22, 2015

Yea, I guess moving it to /api/comments would be ok. I don't feel strongly, as long as its understandable and works (we needed comments.json before because of the simple server assumption).

Per the $.ajax bit, meh. I think it's ok and reduces the number of things that needed to be learned right away. It might be good to have an "advanced" tutorial which goes back through and talks about more topics like mixins, data stores. Overall we probably need a best practices section and should talk about architecture a bit but I don't know the right place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants