DEV Community

Cover image for Node.js fulfill abstraction example.
Abhishek Dhapare
Abhishek Dhapare

Posted on

Node.js fulfill abstraction example.

I write a small weather details fetch web application from external API. you cna look see it on GitHub:

GitHub logo abhishekdhapare9392 / weather-app-node-js

This is application using API's to fetch the weather details with sending city name.

Weather APP - Using NodeJs, Weather API and HTML, CSS, JavaScript


Weather app is created using Node.js, Express.js framework to create the API's. To fetch weather details we used


  1. Backend: Node.js, ExpressJs (Framework)
  2. Frontend: HTML, CSS, JavaScript
  3. API:

Steps to Run

Step 1

Clone the repository on your machine (Desktop/Laptop) using following command
git clone

Step 2

run npm install

Step 3

copy .env.expample file to .env and add API_KEY value with your API key. To get API key visit Open Weather Map API link.

Step 4

run npm start. After running this command you can visit the link http://localhost:3000 for frontend. For API's visit the link http://localhost:3000/doc

Why used Nodejs if we can call the api from JavaScript frontend?

To hide the API Key and url of openweathermap. This is a best example of Opps concept, Abstraction.

To avoid to reveal the API key and resource of third party API in DevTools->Source.

Please visit the GitHub link and follow the document. After you completed the process you will be on browser. (Hopefully on Chrome). Open the Developer Tools->Source you can see the all files loading which required. Click on JS->script.js file and you can see code in side window. If you see carefully and read the code there is an API call without API key and resource link. Please go through it and let me know. I would like to discuss if any one have doubts or queries.


Discussion (0)