Skip to content

Завдання Params server#425

Open
VladSlob wants to merge 2 commits intomate-academy:masterfrom
VladSlob:master
Open

Завдання Params server#425
VladSlob wants to merge 2 commits intomate-academy:masterfrom
VladSlob:master

Conversation

@VladSlob
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Excellent work on this task! Your submission is being approved as it fully meets all the requirements. You've built a robust server that correctly parses URL pathnames and query parameters using modern approaches like the URL API. The code is clean, functional, and handles edge cases well.

As a small suggestion for future improvement, you could make the query parsing in src/createServer.js more concise by replacing the for...of loop with const query = Object.fromEntries(params.searchParams);. Also, remember to remove any debugging console.log statements from your final code. Overall, this is a high-quality submission. Well done!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

const parts = params.pathname.split('/').filter(Boolean);
const query = {};

console.log(params.searchParams);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This console.log appears to be for debugging purposes. It's a good practice to remove such statements from your final code to keep the server output clean.

Comment on lines +14 to +16
for (const [key, value] of params.searchParams) {
query[key] = String(value);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

While this loop works perfectly for building the query object, there's a more modern and concise way to achieve the same result using Object.fromEntries().

It can directly convert the URLSearchParams object into a plain JavaScript object, like this:

const query = Object.fromEntries(params.searchParams);

This would replace lines 10, 14, 15, and 16 with a single, expressive line. This is just a suggestion for future improvement!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants