Introduction

In this blog, we see how to build a weather app using open weather APIs.

Prerequisite

  • node

**Setup Folder **

  • Open console and create a new folder using the below command

## mkdir weather

  • Change to the current directory

## cd weather

Setup Node In Folder

For building projects in Node, we have to setup up a Node environment in our folder.

  • Type the following command to set up Node

## npm init -y

This will generate a package.json file, which means that Node is set up in the folder .

Install Package

We add a package that will be needed to build the application.

  • For adding package type following command

## npm install body-parser ejs express openweather-apis

A little description of the packages we installed:

  • body-parser: extracts the entire body portion of an incoming request stream and exposes it on req.body.
  • ejs: ejs or embedded Javascript templating is a templating engine used by node.js.ejs. It is a simple template language used to generate HTML markup with plain Javascript.
  • express: it is a web framework for node.js.The complete application is built on it
  • openweather-apis: with this package, we can consume the weather APIs.

#nodejs #api

How to Build a Weather Application in NodeJS
5.45 GEEK