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

Function action

pages/api/banks/v1/[code].js:5–20  ·  view source on GitHub ↗
(request, response)

Source from the content-addressed store, hash-verified

3import { getBanksData } from '@/services/banco-central';
4
5const action = async (request, response) => {
6 const bankCode = Number(request.query.code);
7
8 const allBanksData = await getBanksData();
9
10 const bankData = allBanksData.find(({ code }) => code === bankCode);
11
12 if (!bankData) {
13 throw new NotFoundError({
14 message: 'Código bancário não encontrado',
15 type: 'BANK_CODE_NOT_FOUND',
16 });
17 }
18
19 return response.status(200).json(bankData);
20};
21
22export default app().get(action);

Callers

nothing calls this directly

Calls 1

getBanksDataFunction · 0.90

Tested by

no test coverage detected