Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
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
| res.writeHead(200, { 'Content-Type': 'application/json' }); | ||
| res.end(JSON.stringify(expense)); |
There was a problem hiding this comment.
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.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
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
| res.writeHead(200, { 'Content-Type': 'application/json' }); | ||
| res.end(JSON.stringify(expense)); |
There was a problem hiding this comment.
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.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
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
| res.writeHead(200, { 'Content-Type': 'application/json' }); | ||
| res.end(JSON.stringify(expense)); |
There was a problem hiding this comment.
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.
No description provided.