Skip to content

fix(challenge): fix instructions in serve json challenge#13155

Merged
Greenheart merged 1 commit intofreeCodeCamp:stagingfrom
no-stack-dub-sack:fix/clarify-instructions-json-challenge
Feb 13, 2017
Merged

fix(challenge): fix instructions in serve json challenge#13155
Greenheart merged 1 commit intofreeCodeCamp:stagingfrom
no-stack-dub-sack:fix/clarify-instructions-json-challenge

Conversation

@no-stack-dub-sack
Copy link
Copy Markdown
Member

Pre-Submission Checklist

  • Your pull request targets the staging branch of freeCodeCamp.
  • Branch starts with either fix/, feature/, or translate/ (e.g. fix/signin-issue)
  • You have only one commit (if not, squash them into one commit).
  • All new and existing tests pass the command npm test. Use git commit --amend to amend any fixes.

Type of Change

  • Small bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds new functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Add new translation (feature adding new translations)

Checklist:

Description

@BerkeleyTrue BerkeleyTrue added the status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. label Feb 5, 2017

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@no-stack-dub-sack
Copy link
Copy Markdown
Member Author

no-stack-dub-sack commented Feb 5, 2017

@Greenheart I also see a couple other things that could use improvement and I'd like to see if you agree. I kind of did this PR in a hurry last night, so didn't have time to think too critically about this.

First:

While an HTML server serves (you guessed it ?) HTML...

Not sure if I like the "?" here, I think it should maybe be:

While an HTML server serves (you guessed it!) HTML...

Second:

The reference to APIs in the first paragraph here is overall a bit confusing. We are provided with some good info on APIs, but I don't think the concept is sufficiently tied in to the challenge at hand. For instance, as a first time learner of this info (which gives me good perspective), I'm not totally clear on what part of what we're doing in this challenge actually involves an API.

Ae we actually creating an API that serves JSON with this code? Or are we hitting an API that responds with JSON? Or both? I think the former, but if so, who / what is going to utilize this API down the line?

I think it exemplifies the concept of serving JSON well, but could perhaps tie in to the larger scope of building a web app better. Ideally in a concise way that would only add another sentence or 2.

Any thoughts?

Third:

Serve the object {message: 'Hello json'} as a response in JSON format

Since we tell campers in the NPM challenges that JSON keys and values must always be wrapped in double quotes, do you think we should point out here that its best practice not to wrap keys in double quotes like this when sending JSON? I noticed the example follows just regular object notation, and I think someone mentioned to me that this is best practices.

@Greenheart
Copy link
Copy Markdown
Member

Greenheart commented Feb 5, 2017

@no-stack-dub-sack

1 -Yes!

2

Think of an API as a collection of functions. They have different names, might take input and might give some response back.

We're creating a simple API-endpoint (a function) just for demonstration purposes in this case that only will be used by the tests.

I like your idea with how APIs fit into the big picture!

I currently don't see how we could improve the description, but I'm open for suggestions! 😊

3

Good point! How about if we use {"message": "Hello json"}?

@no-stack-dub-sack
Copy link
Copy Markdown
Member Author

no-stack-dub-sack commented Feb 5, 2017

@Greenheart

Perfect for 1 & 3!

2

I get the concepts of an API, and figured as much about only being used for the tests I guess, but to clarify to someone who has never done this before (as I think people who understand it already read it and it clicks for them, so can be a bit biased), how about we just say:

Let’s create a route, or a simple API, that responds with JSON at the path...

I think this would just help to tie things together a bit, and let campers know, with no room for confusion: "what you're doing is creating an API". Since it only adds a few words, I think its worth it for the extra clarity 😄

Also, what about explaining what REST means?

@no-stack-dub-sack
Copy link
Copy Markdown
Member Author

@Greenheart I added the suggestions you had the other day, and made the fixes we (sort of) talked about for the API piece of it. Take a look and let me know if you're good with this. All I really added was "Lets create a simple API by creating a route..." That way it's clear why the explanation of an API was there and ties it in to the challenge a bit more.

Copy link
Copy Markdown
Member

@Greenheart Greenheart left a comment

Choose a reason for hiding this comment

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

@no-stack-dub-sack Sorry for not responding earlier.

This is definitely an improvement, great job! 😄

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@no-stack-dub-sack no-stack-dub-sack force-pushed the fix/clarify-instructions-json-challenge branch from 4b61aa1 to d49d638 Compare February 8, 2017 01:15
@no-stack-dub-sack
Copy link
Copy Markdown
Member Author

@Greenheart Ok, all set, see my note in the outdated about the <dfn> tags though

@Greenheart
Copy link
Copy Markdown
Member

wrapping it in <dfn> will only italicize it, since the backend challenge component does not have the .challenge-instructions class yet

@no-stack-dub-sack Good point! I'd say we could add <dfn> right away though, since it will be fixed once #13164 is merged.

I think that's the last change needed, but what do you say?

@no-stack-dub-sack
Copy link
Copy Markdown
Member Author

@Greenheart yup, I anticipated that and the change was made with yesterday's commit, so if you're review is a thumbs up at this point, it should be good to merge! 😄

Copy link
Copy Markdown
Member

@Greenheart Greenheart left a comment

Choose a reason for hiding this comment

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

@no-stack-dub-sack Again, the delay... 😅

Actually I found something!

This comment was marked as off-topic.

@no-stack-dub-sack no-stack-dub-sack force-pushed the fix/clarify-instructions-json-challenge branch from d49d638 to c54a21a Compare February 13, 2017 03:01
@no-stack-dub-sack
Copy link
Copy Markdown
Member Author

@Greenheart 😱 lol, ok, NOW it's ready... good eye. Although, to be fair, when I was doing this challenge, it didn't seem to matter in what format you sent the object, it would always get converted and come out in correct JSON format, but if I recall correctly, you could send {message: 'Hello json'} or any other way and still pass.

However, I agree that for consistency and so as not to confuse, this makes the most sense.

Copy link
Copy Markdown
Member

@Greenheart Greenheart left a comment

Choose a reason for hiding this comment

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

@no-stack-dub-sack Haha yeah now it's ready!

That's because the res.json() method of Express serializes JSON based on a wide variety of input data, like JS objects that are valid even with single quotes (').

Now, finally, let's continue with other improvements! 😄

@Greenheart Greenheart merged commit 2be14b9 into freeCodeCamp:staging Feb 13, 2017
@BerkeleyTrue BerkeleyTrue removed the status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. label Feb 13, 2017
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.

3 participants