This application is built in the Node.js and Express framework. EJS is the templating engine that is used for manipulating the frontend. I also used AJAX fetch to manipulate DOM. Bootstrap is also used in frontend.
-
Setup the OpenWeatherMap API account
Go to the link OpenWeatherMapAPI click Sign Up, then Sign Up with your username and password. In the section My API keys you can find your API key, save it for now or just remember where you can find it.
-
Clone the project from this repository on github.
To run the following commands, you need to have Git installed on your local machine. If you don't have it, download it here.
Open VS code terminal or git bash and enter this commands
git clone https://github.com/ncrncec23/weather-app-owm.git # Clone the repository from github cd <name-of-your-folder> # Change name_of_your_folder to your folder name
-
Installing dependencies and running Node.js app
First you need to install Node if you don't already have it. Install it here
Check the version if anything pops up it's ok. If not you have not installed it correctly
node -v # Checks the node version npm -v # Checks the node package manager version
To install dependencies run
npm i # Install dependenciesCreate .env file and save your API_KEY in the file
touch .env # Creating the .env file API_KEY="<your_api_key>" # Enter your API_KEY in this format
After creating .env you can run the application by entering
nodemon index.js # OR node index.js