FAQs on the exercise Interacting with Another Backend API
There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
You can also find further discussion and get answers to your questions over in Language Help.
Agree with a comment or answer? Like () to up-vote the contribution!
Terrible exercise. Steps 1 & 2: Half of the code the learner is supposed to write themselves is already half-written but some of it needs to be rewritten in some way, super confusing. Steps 3 & 4 assume the learner knows or somehow guessed from the previous section how to listen to a data and end events. Step 5 was impossible to pass even if my code was identical to the solution, which I had to check for each step given how badly written the instructions were. It’s almost impossible to understand at which moment we’re supposed to stop writing the code for a step in order to validate it. So if you write ‘too much’ instead of a partial code block, the step can be validated, but then you also have no clue what to do in the next one, since you’ve already written the full answer and yet the next step is still not validated. I really wish Codecademy would take feedback from a user who reads this lesson for the first time before going into designing such exercises.
Terrible exercise. Hints are not that detailed and the steps assume that a first-time learner knows everything. This SETTING UP A HTTP SERVER section is the worst section I encountered in my time with Codecademy. Everything assumes we know all and the code results are bugged. Nothing works until I click replace my code with the solution. I hope Codecademy fixes this whole section. This section is totally not for new learners. It’s bugged in one word.
Yup. I’ll second the emotion here. Again. Your Learning JavaScript unit is polished. So much so I bit the hook. Now I’m on the hook but I still need to learn.
In the handleGetRequest function while creating a request I am seeing that we can use response.on to chunk the data and the next step, but according to my understanding .on is only valid on the event emitter instance. My query is, is the response argument an event emitter instance, if so then how would you know what is an event emitter instance and what is not? The reference to the code is below, please help!!
let data = '';
// Aggregate data chunks as they come in from the API
response.on('data', (chunk) => {
data += chunk;
});
// Handle the end of the request
response.on('end', () => {
console.log("Retrieved Data:", data);
res.end(data);
Ok, seems like the problem is permissions, codecademy won’t let its own virtual env access the json contents it’s suppossed to get in this excercise. I just finished this lesson by doing this:
This is a terribly implemented lesson. The first step leaves out guiding the learner to add headers to the options model should be:
headers: {
'Content-Type': 'application/json'
}
Secondly, this lesson just doesn’t work. Step 5 will never validate. Here are the steps I took to prove this:
go through the lesson and bang my head on the wall because the last step won’t validate.
Click “View solution” and verify that my solution matches verbatim.
Finally click “Replace with Solution” and let step 5 pass.
Re-do the lesson with the same results, this time copy the solution from the “View Solution” code and paste it in at step 1.
Check work and validate all steps except step 5.
If you’re having problems with this lesson I suggest verifying your code is similar to the solution, replace it with the solution, and move on. I wasted hours on this.
this exercise is buggy. In the given solution, within the request callback function there is a variable called “res” that is never defined. My solution should be working fine, however it failed step 5. I then the code for step 5 into my solution and it still failed. It only worked when I opted to settle for the given solution. Also getting error messages for using different quotation style is annoying
If you mean res.end(), then res is a response object from parameter of the callback function in createServer().
It is response that client will receive. When we run res.end() we end response message and send it to the client.