Skip to content

Conversation

@hussam-it-max
Copy link

No description provided.

@hussam-it-max hussam-it-max changed the title Assignment-w1-NodeJs Assignment-w2-NodeJs Aug 12, 2025
@durw4rd durw4rd self-assigned this Aug 26, 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.

Great job as far as programming goes! I noticed a few typos here and there and some minor opportunities for improvement, but you clearly mastered the topic taught in this module.
The main point of feedback from my side would be that you are not following the instructions very closely, and your app is actually likely rendering the wrong piece of data from the API. Lack of attention to detail can potentially be quite detrimental to the perception of your work.

@@ -0,0 +1,5 @@
import app from "./app.js";
const PORT = process.env.PORT || 3000;
Copy link

Choose a reason for hiding this comment

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

Great that you're using an environment variable with a fallback.

"name": "hackyourtemperature",
"version": "1.0.0",
"description": "",
"main": "index.js",
Copy link

Choose a reason for hiding this comment

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

This should point to server.js since that's your main file.

"cross-env": "^10.0.0",
"jest": "^30.0.5",
"nodemon": "^3.1.10",
"superset": "^2.0.1",
Copy link

Choose a reason for hiding this comment

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

Possibly a typo? I don't see this package used anywhere in the project.

Copy link

Choose a reason for hiding this comment

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

This is an excellent addition that was not required in the instructions 👏

router.post("/", async (req, res) => {
const { cityName } = req.body;
if (!cityName) {
res.status(400).render("home", { errorMessage: "City is required" });
Copy link

Choose a reason for hiding this comment

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

There should be a return statement to prevent further execution.

const response = await fetch(URL);

const data = await response.json();
res.render("weatherShow", { data });
Copy link

Choose a reason for hiding this comment

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

This is a point of preference and overall API design, but the instructions asked to return temperature info for the selected city. You are returning the entire blob of data, which then needs to be parsed by the requesting client. This can work, but the client needs to be aware of this fact.

<title>Weather show</title>
</head>
<body>
<h1>{{data.name}} <b>{{data.main.temp_min}}</b></h1>
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 test the API, but this doesn't seem like the correct field for showing the actual temperature. I think it should be data.main.temp.

Copy link

Choose a reason for hiding this comment

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

To clarify, you should have replaced this and the babe.config.csj files with the examples from the assignment instructions.

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