Skip to content

Instantly share code, notes, and snippets.

@suissa
Forked from Pompeu/cpf_consulta_api_sus.js
Last active June 21, 2020 19:57
Show Gist options
  • Save suissa/b5184f8cd97e977e63abcab8433a1947 to your computer and use it in GitHub Desktop.
Save suissa/b5184f8cd97e977e63abcab8433a1947 to your computer and use it in GitHub Desktop.
cpf_consulta_api_sus.js
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}`
let body = ''
http.get(consult, (res) =>
res
.on('data', data => body += data)
.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