solution#481
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation correctly parses URL query parameters and returns the parts array, but there's a critical bug that needs fixing: doubled slashes in URL paths are not being filtered. When a path like //hello/world is requested, split('/') produces ['', 'hello', 'world'] instead of the expected ['hello', 'world']. You need to add .filter(part => part !== '') after the split to remove empty string entries. Also, please remove the console.log(parts) debug statement before finalizing. Once this filtering is added, your code will pass all requirements.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| // Return instance of http.Server class | ||
| const server = http.createServer((req, res) => { | ||
| const normalizedURL = new URL(req.url, 'http://localhost:5700'); | ||
| const parts = normalizedURL.pathname.split('/').slice(1); |
There was a problem hiding this comment.
This line needs to filter out empty strings from doubled slashes. Currently /hello works but //hello produces ['', 'hello'] instead of ['hello']. Add .filter(part => part !== '') to remove empty segments.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution correctly implements all task requirements. The doubled slashes are properly filtered using the .filter() method, query parameters are correctly parsed into an object, and the server returns the expected JSON structure with both parts and query properties. The implementation passes all checklist items. There's one minor cleanup item: a debug console.log(parts) statement on line X that should be removed before production, but this is a cosmetic issue that doesn't affect functionality.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.