Skip to content

Instantly share code, notes, and snippets.

@AlexSJ
Forked from Pompeu/cpf_consulta_api_sus.js
Created December 5, 2016 02:56
Show Gist options
  • Save AlexSJ/805b8d7093adc37574b36b1fa70a249f to your computer and use it in GitHub Desktop.
Save AlexSJ/805b8d7093adc37574b36b1fa70a249f to your computer and use it in GitHub Desktop.
cpf_consulta_api_sus.js
'use strict';
const http = require('http');
const cpf = process.argv[2];
const url = 'http://dabsistemas.saude.gov.br/sistemas/sadab/js/buscar_cpf_dbpessoa.json.php?cpf='
const consult = `${url}${cpf}`;
http.get(consult, res => {
let body = '';
res.on('data', data => body += data)
res.on('end', () => {
console.log(JSON.parse(body));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment