us-census-api

Acess census.gov API

us-census-api

NodeJS interface for census.gov API. Currently only supports sf1 searching.
$ npm install us-census-api
Ability to search other data sets 
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
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
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));