June 2014
Intermediate to advanced
696 pages
38h 52m
English
A common use of the HTTP services in Node.js is to access external systems to get data to fulfill client requests. A variety of external systems provide data that can be used in various ways. In this example, the code connects to the openweathermap.org API to retrieve weather information about a city. To keep the example simple, the output from openweathermap.org is pushed to the browser in a raw format. In reality, you would likely massage the pieces of data needed into your own pages, widgets, or data responses.
Listing 7.7 shows the implementation of a web service that accepts both GET and POST requests. For GET requests, a simple webpage with a form is returned that allows the user to post a city name. Then ...
Read now
Unlock full access