Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
JavaScript by Example

You're reading from   JavaScript by Example Learn modern web development with real-world applications

Arrow left icon
Product type Paperback
Published in Aug 2017
Publisher Packt
ISBN-13 9781788293969
Length 298 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Dani Akash S Dani Akash S
Author Profile Icon Dani Akash S
Dani Akash S
Arrow right icon
View More author details
Toc

Building the Weather Widget

For this chapter, we need a server to fetch weather information for a given location. In the browser, we can use navigator object to retrieve the exact geolocation (latitude and longitude) of the user. Then, using these coordinates, we need to find the name of the region and its weather information. For this purpose, we need to use third-party weather providers and the Google Maps API, which we used in Chapter 3, Event Registration App. The weather provider we are going to use in this project is Dark Sky.

Let's set up the server for the Weather Widget. Open up the Chapter05\Server directory in the book code. Inside the server directory, first run npm install to install all the dependencies. You need to get the API keys for both Dark Sky and Google Maps. You might already have the Google Map API key, since we used it recently. To generate your API...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image