0.0.5 • Published 11 years ago

us-census-api v0.0.5

Weekly downloads
30
License
-
Repository
github
Last release
11 years ago

us-census-api

NodeJS interface for census.gov API. Currently only supports sf1 searching.

Installation

$ npm install us-census-api

Coming Soon

Ability to search other data sets 

API Key

You can add your API key to the file lib/api_key.json by changing the variable key to your API key
or pass it as a parameter in the object

Query Parameters

You can search by state and county; using either fips, 2 letter code, or name
You can use a wildcard (*) for state or county
For population, you can just enter 'total', 'white', 'black', etc, 
or use the "P" codes from census.gov developer API

Example

var census = require('us-census-api');

var callback = function (res) {
    var str = '';

    res.on('data', function(chunk) {
        str += chunk;
    });

    res.on('end', function() {
        console.log('Return: ' + str);
    });
};

var params = {
    year: 2010,
    population: 'total',
    api_key: 'YOUR_KEY_HERE',
    state: 'fl',
    county: 'pinellas'
};

console.log(census.sf1(params, callback));
0.0.5

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago