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...