Skip to content
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

Closed
wants to merge 2 commits into from
Closed

Conversation

Akif2709
Copy link

No description provided.

Copy link

@eidosam eidosam left a 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!

break;
default:
if (request.url === '' || request.url === '/') {
response.statusCode = 302;
Copy link

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.

Copy link
Author

Choose a reason for hiding this comment

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

I corrected it

});

return server;
}

module.exports = {
createServer
// eslint-disable-next-line comma-dangle
Copy link

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].

Copy link
Author

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.

@NoerGitKat NoerGitKat closed this Jun 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants