Skip to content

Conversation

@dashaaaa21
Copy link

No description provided.

@durw4rd durw4rd self-assigned this Nov 1, 2025
Copy link

@durw4rd durw4rd left a comment

Choose a reason for hiding this comment

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

Good job, Daryna - your work has all that was required. Great start before the second week :)

const { cityName } = req.body;
if (!cityName) {
return res.status(400).send('Error: cityName is required in request body');
}
Copy link

Choose a reason for hiding this comment

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

Nice that you added validation of the payload 👍

});

app.listen(PORT, () => {
console.log(`Server listening on http://localhost:${PORT}`);
Copy link

Choose a reason for hiding this comment

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

It's perfectly fine to hardcode the domain in an exercise like this, but in situations where the app may run in environments other than locally, that should be avoided.
One option is to avoid mentioning the host: console.log(`Server listening on port ${PORT}`);
Alternatively, you can read it from the HOST environment variable: const HOST = process.env.HOST || 'localhost';

@dashaaaa21
Copy link
Author

Thank you very much!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants