Easy CEP (brazilian postal code) finder.
npm install cep-finder
ES6 modules
import cepFinder from "cep-finder";
or CommonJS
const cepFinder = require("cep-finder");
cepFinder("01311300").then(result => console.log(result));
will produce the following object:
{
logradouro: "Avenida Paulista",
complemento: "de 1867 ao fim - lado ímpar",
bairro: "Bela Vista",
cidade: "São Paulo",
estado: "SP",
cep: "01311-300"
}
nodeJS:
When running in node by default the Correios page will be used. it is also possible use ViaCEP providing "webservice" as a second parameter:
cepFinder("01311300", "webservice").then(result => console.log(result));
browser:
To avoid CORS problems, ViaCEP is always used.
npm test