Skip to content

solution#172

Open
Ga1dar wants to merge 4 commits intomate-academy:masterfrom
Ga1dar:develop
Open

solution#172
Ga1dar wants to merge 4 commits intomate-academy:masterfrom
Ga1dar:develop

Conversation

@Ga1dar
Copy link

@Ga1dar Ga1dar commented Jan 2, 2026

No description provided.

Copy link

@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

Great work on setting up the server to handle the form submission and save the data! The core logic is working well. However, one key requirement isn't met, so I'm requesting a change.

The task requires you to return an HTML page that displays the submitted data as well-formatted JSON. Currently, your server sends a raw JSON response with a Content-Type of application/json.

To fix this, please change the response to send an HTML document. You should set the Content-Type header to text/html and wrap the JSON string inside an HTML structure. Using a <pre> tag is a great way to display the formatted JSON nicely on the page.


✨ 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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment on lines +120 to +121
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify(expense));

Choose a reason for hiding this comment

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

The task requires you to 'return an HTML page with well formatted JSON'. Currently, you are sending a raw JSON response with Content-Type: application/json. You should set the Content-Type to text/html and send an HTML document that displays the formatted JSON. A good way to display pre-formatted text like JSON in HTML is by using the <pre> tag.

Copy link

@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

Great job on setting up the server and implementing the logic to save the form data to a file! The core functionality is working correctly. However, I'm requesting a change because the server's response after saving the data doesn't meet a key requirement. Currently, it sends back raw JSON, but the task requires you to return a full HTML page that displays this saved data. To fix this, please update your POST request handler in src/createServer.js to set the Content-Type header to text/html and wrap the JSON string within an HTML document. Using a <pre> tag for the JSON is a great way to keep it nicely formatted.


✨ 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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment on lines +102 to +103
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify(expense));

Choose a reason for hiding this comment

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

According to the task requirements, after saving the data, the server must return an HTML page that displays the saved data as well-formatted JSON.

Currently, you are returning a raw JSON response. You should change the Content-Type header to text/html and wrap the JSON string within an HTML structure. Using a <pre> tag is a good way to preserve the JSON formatting.

Copy link

@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

I'm approving this submission as an educational override to help you progress, as there are a few important requirements still to address. You've done an excellent job with the HTML form and the server logic for saving the expense data to a file!

The main area for improvement is how the server responds after saving the data. The task requires returning a full HTML page that displays the saved JSON. Currently, your server in src/createServer.js sends back raw JSON with a Content-Type of application/json.

To meet the requirement, you'll need to update your POST handler. First, set the response header to res.setHeader('Content-Type', 'text/html'). Then, instead of just sending the JSON string, construct a basic HTML document and embed the formatted JSON within it. Using <pre> tags is a great way to preserve the formatting. Keep up the great work!


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

Footnotes

  1. Rate AI review example

Comment on lines +85 to +86
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify(expense));

Choose a reason for hiding this comment

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

The task requires the server to return an HTML page after saving the data, not a raw JSON response. The Content-Type header should be text/html, and the response body needs to be an HTML document that includes the formatted JSON.

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