Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oleksandr Week 1 Node JS #7

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

aleksandrvasilyev
Copy link

No description provided.

package.json Outdated
Copy link

Choose a reason for hiding this comment

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

Seems the file structure got a bit mingled - the package.json file is outside of the app folder.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, you are right, I have to use unique package.json for each app, and not one package.json for all the apps.


app.post("/weather", (req, res) => {
const cityName = req.body.cityName;
res.json({ cityName });
Copy link

Choose a reason for hiding this comment

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

I didn't look into the assignments for the upcoming weeks yet so I don't know in which direction this project evolves. Nothing wrong with using the res.json() method for now, just be aware there is also the more versatile option res.send() if you need/want to send other data types: https://www.geeksforgeeks.org/difference-between-res-send-and-res-json-in-express/

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.

Well done, Oleksandr!

@durw4rd durw4rd self-assigned this Oct 6, 2024
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