Question
For this assignment, You will create a NodeJS application which takes a city name as an input in its pug template. using openweathermap API, you
For this assignment, You will create a NodeJS application which takes a city name as an input in its pug template. using openweathermap API, you should get the weather of that particular city and displays that information to a new pug template. You should also store the results in a file in your directory. Following are the detailed requirements.
Your application should start with a pug template (similar to HTML page) which has a form with an input field and label to accept the city name and a button on clicking which we can send a GET request to the server.
Your server code (Back-end) should be able to take this city name, make an API call to the openweathermap API.
You should be able successfully to establish the API call and retrieve data from it.
You should also be able to display this data in a new pug template.
This same pug template will also have a form in which we should be able to enter the data you that we received from openweathermap.
On entering and submitting that data, You should be able to make a POST request to your back-end.
Your back-end code should write those values to a file in your local directory using async and fs.
Openweathermap API documentation: https://openweathermap.org/api
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started