MCPcopy Create free account
hub / github.com/BrasilAPI/BrasilAPI / getAllCitiesData

Function getAllCitiesData

services/cptec/cities.js:23–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21 * @returns {Array}
22 */
23export const getAllCitiesData = async () => {
24 const citiesData = await axios.get(`${CPTEC_URL}/listaCidades`, {
25 responseType: 'application/xml',
26 responseEncoding: 'binary',
27 });
28
29 const parsed = parser.parse(citiesData.data);
30 if (parsed.cidades.cidade) {
31 return parsed.cidades.cidade.map(formatCity);
32 }
33 return [];
34};
35
36/**
37 * Search Brazilian cities by name

Callers 1

getAllCitiesFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected