Skip to content

Instantly share code, notes, and snippets.

@eng
Last active August 29, 2015 13:59
Show Gist options
  • Save eng/10670661 to your computer and use it in GitHub Desktop.
Save eng/10670661 to your computer and use it in GitHub Desktop.
Ridiculously Simple Public API Consumption – Node.js Demo

Install Node.js from http://nodejs.org/

Create a folder for your project

mkdir weather
cd weather

Install require modules

# Install CoffeeScript globally so that binaries are installed
sudo npm install -g coffee-script

# Install openweathermap module locally to the project folder
npm install openweathermap

Create a file called weather.coffee

weather = require 'openweathermap'

weather.defaults
  units: 'imperial'

weather.now q: 'Chicago', (data) ->
  console.log data

Run it

coffee weather.coffee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment