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
Akif_NodeW1_Homework #350
Akif_NodeW1_Homework #350
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job Akif! There are small notes inline, please have a look!
week1/homework/src/server.js
Outdated
break; | ||
default: | ||
if (request.url === '' || request.url === '/') { | ||
response.statusCode = 302; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of issues here:
request.url
will never be empty string, root is/
.- Code
302
refers to temporal redirection, which is not the case here. - Because there was explicit headers setting above (line 12), setting
response.statusCode
won't take an effect, see response.statusCode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I corrected it
week1/homework/src/server.js
Outdated
}); | ||
|
||
return server; | ||
} | ||
|
||
module.exports = { | ||
createServer | ||
// eslint-disable-next-line comma-dangle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to fix linting errors/warnings instead of disabling Eslint rule[s].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that but sometimes when I save the file, Eslint changes it incorrectly and even though I correct it by hand Eslint makes it incorrect. For instance, in the 'if-else' structure I write 'else' at the correct place but same problem. I don't know why.
No description provided.