Skip to content

Add solution#427

Open
dminikulin wants to merge 1 commit intomate-academy:masterfrom
dminikulin:develop
Open

Add solution#427
dminikulin wants to merge 1 commit intomate-academy:masterfrom
dminikulin:develop

Conversation

@dminikulin
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

Decision: APPROVE

Your createServer implementation cleanly meets the task requirements: it responds with JSON containing exactly parts and query, correctly filters empty path segments from leading/trailing/multiple slashes, parses query parameters as strings, and sets Content-Type: application/json. The root path and empty query-string cases are handled correctly, and the code is concise and idiomatic.

Minor, non-blocking suggestions for future robustness:

  • Consider decoding path segments (e.g., map decodeURIComponent over parts) if you need human-readable values for percent-encoded URLs.
  • For repeated query keys (e.g., ?x=1&x=2), you currently keep the last value; if multiple values should be preserved, use searchParams.getAll(key) and return arrays when appropriate.
  • Using the WHATWG URL API (new URL(req.url, base)) can make parsing more robust in broader contexts.

Nice work—this is solid and ready to go.


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

Footnotes

  1. Rate AI review example

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