Homework Assignment 1 from Pirple's Node.js Master Class
The exercises were typed in as the course progressed. Files were committed at the end of each lecture. The homework assignment involved swapping out 'sample' for 'hello' and rewriting the json message.
Some of the code has had comments added, mainly to help me structure the main parts in my mind.
My IDE is complaining that the comparison typeof(statusCode) == 'number'
could cause unexpected type coercion and suggests using ===
. I have not followed its
advice because I don't understand the reason why yet. I have looked at
https://stackoverflow.com/questions/15768729/when-is-it-ok-to-use-in-javascript and one of the
replies seems to suggest that because we've used the typeOf to check its a number == is fine.
Everything works on HTTP at 'hello' but there is no response from HTTPS. Hopefully the reason why will become apparent later on.