Book Image

CoffeeScript Application Development Cookbook

By : Mike Hatfield
Book Image

CoffeeScript Application Development Cookbook

By: Mike Hatfield

Overview of this book

Table of Contents (18 chapters)
CoffeeScript Application Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Working with web services


Even though it is likely that our own application exposes some form of JSON API, it may also need to connect with other external services in order to perform its tasks.

It is becoming common for online services to provide web APIs, which allow us to use their services in our own applications.

In this recipe, we will see how to connect to an external service, request information, and process that information.

Getting ready

We will use the REST client for the Node.js npm module hosted on GitHub at github.com/aacerox/node-rest-client.

This client allows us to call RESTful services and retrieve results.

To get started, we will install the REST client:

npm install node-rest-client --save

We will use a free RESTful service that provides access to geographic and weather information. You can find out more about this free service from their website at http://www.geonames.org.

GeoNames provides a number of web services that expose their geographical database, including country...