├── LICENSE
├── README.md
├── package-lock.json
├── package.json
├── server.js
└── src
├── index.js
└── routes
├── cep.js
└── frete.js
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Aluizio Developer
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Informação sobre tecnologia, dicas, tutoriais, mini-cursos e muito mais.
8 |
9 |
10 | ## Conhecendo uma Biblioteca Gratuita Node.js para Consulta de CEP e Cálculo de Frete na API dos Correios
11 |
12 | Neste post vamos aprender a utilizar a API dos correios para consulta de CEP, cálculo de frete e prazo, a partir de uma biblioteca gratuita implementada com o Node.js e disponível no Github.
13 |
14 | ## Implementação do Exemplo
15 |
16 | 1. Criar o diretório do projeto e proceder com a instalação dos pacotes através do `npm`:
17 |
18 | ```shell
19 | mkdir api-correios
20 |
21 | cd api-correios
22 |
23 | npm init -y
24 |
25 | npm install --save express node-correios
26 | ```
27 |
28 | 2. Conteúdo do arquivo principal desse exemplo, `server.js`:
29 |
30 | ```js
31 | const express = require('express')
32 | const app = express()
33 |
34 | app.use(express.json());
35 |
36 | require('./src')(app)
37 |
38 | app.listen(3000, () => {
39 | console.log('Server started on port 3000!')
40 | })
41 | ```
42 |
43 | 3. Conteúdo do arquivo que chama as rotas da aplicação, `src/index.js`:
44 |
45 | ```js
46 | module.exports = (app) => {
47 | app.use('/cep', require('./routes/cep'))
48 | app.use('/frete', require('./routes/frete'))
49 | }
50 | ```
51 |
52 | 4. Conteúdo do arquivo com a rota para consulta de cep, `src/routes/cep.js`:
53 |
54 | ```js
55 | const express = require('express')
56 | const router = express.Router()
57 | const ApiNodeCorreios = require('node-correios')
58 |
59 | const correios = new ApiNodeCorreios()
60 |
61 | router.post('/', (request, response) => {
62 | const { cep } = request.body
63 |
64 | correios.consultaCEP({ cep }).then(result => {
65 |
66 | return response.json(result)
67 |
68 | }).catch(error => {
69 |
70 | return response.json(error)
71 |
72 | });
73 | })
74 |
75 | module.exports = router
76 | ```
77 |
78 | 5. Conteúdo do arquivo com a rota para cálculo de frete, `src/routes/frete.js`:
79 |
80 | ```js
81 | const express = require('express')
82 | const router = express.Router()
83 | const ApiNodeCorreios = require('node-correios')
84 |
85 | const correios = new ApiNodeCorreios()
86 |
87 | router.post('/', (request, response) => {
88 | const {
89 | nCdServico,
90 | sCepOrigem,
91 | sCepDestino,
92 | nVlPeso,
93 | nCdFormato,
94 | nVlComprimento,
95 | nVlAltura,
96 | nVlLargura,
97 | nVlDiametro,
98 | } = request.body;
99 |
100 | correios.calcPreco({
101 | nCdServico,
102 | sCepOrigem,
103 | sCepDestino,
104 | nVlPeso,
105 | nCdFormato,
106 | nVlComprimento,
107 | nVlAltura,
108 | nVlLargura,
109 | nVlDiametro,
110 | }).then(result => {
111 |
112 | return response.json(result)
113 |
114 | }).catch(error => {
115 |
116 | return response.json(error)
117 |
118 | });
119 | })
120 |
121 | module.exports = router
122 | ```
123 |
124 | 6. Exemplo do campo Body na requisição POST no Insomnia:
125 |
126 | ```json
127 | {
128 | "nCdServico": "40010",
129 | "sCepOrigem": "22270010",
130 | "sCepDestino": "89010000",
131 | "nVlPeso": 1,
132 | "nCdFormato": 1,
133 | "nVlComprimento": 27,
134 | "nVlAltura": 8,
135 | "nVlLargura": 10,
136 | "nVlDiametro": 18
137 | }
138 | ```
139 |
140 | 7. Rodar o projeto:
141 |
142 | ```shell
143 | node server.js
144 | ```
145 |
146 | ## Redes Sociais
147 |
148 | [Site Aluizio Developer](https://aluiziodeveloper.com.br)
149 |
150 | [YouTube](https://www.youtube.com/jorgealuizio)
151 |
152 | [Servidor no Discord](https://discord.gg/3J87BMz5fD)
153 |
154 | [LinkedIn](https://www.linkedin.com/in/jorgealuizio/)
155 |
156 | ## Referências
157 |
158 | [Github API Consulta CEP dos Correios](https://github.com/vitorleal/node-correios)
159 |
160 | [PDF - Manual Técnico de Integração com a API dos Correios](http://www.correios.com.br/enviar-e-receber/ferramentas/calculador-remoto-de-precos-e-prazos/pdf/manual-de-implementacao-do-calculo-remoto-de-precos-e-prazos)
161 |
--------------------------------------------------------------------------------
/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "api-correios",
3 | "version": "1.0.0",
4 | "lockfileVersion": 1,
5 | "requires": true,
6 | "dependencies": {
7 | "@types/caseless": {
8 | "version": "0.12.2",
9 | "resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.2.tgz",
10 | "integrity": "sha512-6ckxMjBBD8URvjB6J3NcnuAn5Pkl7t3TizAg+xdlzzQGSPSmBcXf8KoIH0ua/i+tio+ZRUHEXp0HEmvaR4kt0w=="
11 | },
12 | "@types/node": {
13 | "version": "14.11.1",
14 | "resolved": "https://registry.npmjs.org/@types/node/-/node-14.11.1.tgz",
15 | "integrity": "sha512-oTQgnd0hblfLsJ6BvJzzSL+Inogp3lq9fGgqRkMB/ziKMgEUaFl801OncOzUmalfzt14N0oPHMK47ipl+wbTIw=="
16 | },
17 | "@types/request": {
18 | "version": "2.48.5",
19 | "resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.5.tgz",
20 | "integrity": "sha512-/LO7xRVnL3DxJ1WkPGDQrp4VTV1reX9RkC85mJ+Qzykj2Bdw+mG15aAfDahc76HtknjzE16SX/Yddn6MxVbmGQ==",
21 | "requires": {
22 | "@types/caseless": "*",
23 | "@types/node": "*",
24 | "@types/tough-cookie": "*",
25 | "form-data": "^2.5.0"
26 | },
27 | "dependencies": {
28 | "form-data": {
29 | "version": "2.5.1",
30 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
31 | "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
32 | "requires": {
33 | "asynckit": "^0.4.0",
34 | "combined-stream": "^1.0.6",
35 | "mime-types": "^2.1.12"
36 | }
37 | }
38 | }
39 | },
40 | "@types/tough-cookie": {
41 | "version": "4.0.0",
42 | "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.0.tgz",
43 | "integrity": "sha512-I99sngh224D0M7XgW1s120zxCt3VYQ3IQsuw3P3jbq5GG4yc79+ZjyKznyOGIQrflfylLgcfekeZW/vk0yng6A=="
44 | },
45 | "accepts": {
46 | "version": "1.3.7",
47 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
48 | "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
49 | "requires": {
50 | "mime-types": "~2.1.24",
51 | "negotiator": "0.6.2"
52 | }
53 | },
54 | "ajv": {
55 | "version": "6.12.5",
56 | "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.5.tgz",
57 | "integrity": "sha512-lRF8RORchjpKG50/WFf8xmg7sgCLFiYNNnqdKflk63whMQcWR5ngGjiSXkL9bjxy6B2npOK2HSMN49jEBMSkag==",
58 | "requires": {
59 | "fast-deep-equal": "^3.1.1",
60 | "fast-json-stable-stringify": "^2.0.0",
61 | "json-schema-traverse": "^0.4.1",
62 | "uri-js": "^4.2.2"
63 | }
64 | },
65 | "array-flatten": {
66 | "version": "1.1.1",
67 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
68 | "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
69 | },
70 | "asn1": {
71 | "version": "0.2.4",
72 | "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
73 | "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==",
74 | "requires": {
75 | "safer-buffer": "~2.1.0"
76 | }
77 | },
78 | "assert-plus": {
79 | "version": "1.0.0",
80 | "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
81 | "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU="
82 | },
83 | "asynckit": {
84 | "version": "0.4.0",
85 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
86 | "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
87 | },
88 | "aws-sign2": {
89 | "version": "0.7.0",
90 | "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
91 | "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg="
92 | },
93 | "aws4": {
94 | "version": "1.10.1",
95 | "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.1.tgz",
96 | "integrity": "sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA=="
97 | },
98 | "bcrypt-pbkdf": {
99 | "version": "1.0.2",
100 | "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
101 | "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=",
102 | "requires": {
103 | "tweetnacl": "^0.14.3"
104 | }
105 | },
106 | "bluebird": {
107 | "version": "3.7.2",
108 | "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
109 | "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg=="
110 | },
111 | "body-parser": {
112 | "version": "1.19.0",
113 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
114 | "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
115 | "requires": {
116 | "bytes": "3.1.0",
117 | "content-type": "~1.0.4",
118 | "debug": "2.6.9",
119 | "depd": "~1.1.2",
120 | "http-errors": "1.7.2",
121 | "iconv-lite": "0.4.24",
122 | "on-finished": "~2.3.0",
123 | "qs": "6.7.0",
124 | "raw-body": "2.4.0",
125 | "type-is": "~1.6.17"
126 | }
127 | },
128 | "buffer-from": {
129 | "version": "1.1.1",
130 | "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
131 | "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A=="
132 | },
133 | "bytes": {
134 | "version": "3.1.0",
135 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
136 | "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
137 | },
138 | "caseless": {
139 | "version": "0.12.0",
140 | "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
141 | "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
142 | },
143 | "combined-stream": {
144 | "version": "1.0.8",
145 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
146 | "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
147 | "requires": {
148 | "delayed-stream": "~1.0.0"
149 | }
150 | },
151 | "concat-stream": {
152 | "version": "2.0.0",
153 | "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz",
154 | "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==",
155 | "requires": {
156 | "buffer-from": "^1.0.0",
157 | "inherits": "^2.0.3",
158 | "readable-stream": "^3.0.2",
159 | "typedarray": "^0.0.6"
160 | }
161 | },
162 | "content-disposition": {
163 | "version": "0.5.3",
164 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
165 | "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
166 | "requires": {
167 | "safe-buffer": "5.1.2"
168 | }
169 | },
170 | "content-type": {
171 | "version": "1.0.4",
172 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
173 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
174 | },
175 | "cookie": {
176 | "version": "0.4.0",
177 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz",
178 | "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg=="
179 | },
180 | "cookie-signature": {
181 | "version": "1.0.6",
182 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
183 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
184 | },
185 | "core-util-is": {
186 | "version": "1.0.2",
187 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
188 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
189 | },
190 | "dashdash": {
191 | "version": "1.14.1",
192 | "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
193 | "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
194 | "requires": {
195 | "assert-plus": "^1.0.0"
196 | }
197 | },
198 | "debug": {
199 | "version": "2.6.9",
200 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
201 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
202 | "requires": {
203 | "ms": "2.0.0"
204 | }
205 | },
206 | "delayed-stream": {
207 | "version": "1.0.0",
208 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
209 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
210 | },
211 | "depd": {
212 | "version": "1.1.2",
213 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
214 | "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
215 | },
216 | "destroy": {
217 | "version": "1.0.4",
218 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
219 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
220 | },
221 | "ecc-jsbn": {
222 | "version": "0.1.2",
223 | "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
224 | "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=",
225 | "requires": {
226 | "jsbn": "~0.1.0",
227 | "safer-buffer": "^2.1.0"
228 | }
229 | },
230 | "ee-first": {
231 | "version": "1.1.1",
232 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
233 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
234 | },
235 | "encodeurl": {
236 | "version": "1.0.2",
237 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
238 | "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
239 | },
240 | "escape-html": {
241 | "version": "1.0.3",
242 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
243 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
244 | },
245 | "etag": {
246 | "version": "1.8.1",
247 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
248 | "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
249 | },
250 | "express": {
251 | "version": "4.17.1",
252 | "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz",
253 | "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==",
254 | "requires": {
255 | "accepts": "~1.3.7",
256 | "array-flatten": "1.1.1",
257 | "body-parser": "1.19.0",
258 | "content-disposition": "0.5.3",
259 | "content-type": "~1.0.4",
260 | "cookie": "0.4.0",
261 | "cookie-signature": "1.0.6",
262 | "debug": "2.6.9",
263 | "depd": "~1.1.2",
264 | "encodeurl": "~1.0.2",
265 | "escape-html": "~1.0.3",
266 | "etag": "~1.8.1",
267 | "finalhandler": "~1.1.2",
268 | "fresh": "0.5.2",
269 | "merge-descriptors": "1.0.1",
270 | "methods": "~1.1.2",
271 | "on-finished": "~2.3.0",
272 | "parseurl": "~1.3.3",
273 | "path-to-regexp": "0.1.7",
274 | "proxy-addr": "~2.0.5",
275 | "qs": "6.7.0",
276 | "range-parser": "~1.2.1",
277 | "safe-buffer": "5.1.2",
278 | "send": "0.17.1",
279 | "serve-static": "1.14.1",
280 | "setprototypeof": "1.1.1",
281 | "statuses": "~1.5.0",
282 | "type-is": "~1.6.18",
283 | "utils-merge": "1.0.1",
284 | "vary": "~1.1.2"
285 | }
286 | },
287 | "extend": {
288 | "version": "3.0.2",
289 | "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
290 | "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="
291 | },
292 | "extsprintf": {
293 | "version": "1.3.0",
294 | "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
295 | "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU="
296 | },
297 | "fast-deep-equal": {
298 | "version": "3.1.3",
299 | "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
300 | "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
301 | },
302 | "fast-json-stable-stringify": {
303 | "version": "2.1.0",
304 | "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
305 | "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="
306 | },
307 | "finalhandler": {
308 | "version": "1.1.2",
309 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
310 | "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==",
311 | "requires": {
312 | "debug": "2.6.9",
313 | "encodeurl": "~1.0.2",
314 | "escape-html": "~1.0.3",
315 | "on-finished": "~2.3.0",
316 | "parseurl": "~1.3.3",
317 | "statuses": "~1.5.0",
318 | "unpipe": "~1.0.0"
319 | }
320 | },
321 | "forever-agent": {
322 | "version": "0.6.1",
323 | "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
324 | "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE="
325 | },
326 | "form-data": {
327 | "version": "2.3.3",
328 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
329 | "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
330 | "requires": {
331 | "asynckit": "^0.4.0",
332 | "combined-stream": "^1.0.6",
333 | "mime-types": "^2.1.12"
334 | }
335 | },
336 | "forwarded": {
337 | "version": "0.1.2",
338 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
339 | "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
340 | },
341 | "fresh": {
342 | "version": "0.5.2",
343 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
344 | "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
345 | },
346 | "getpass": {
347 | "version": "0.1.7",
348 | "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
349 | "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
350 | "requires": {
351 | "assert-plus": "^1.0.0"
352 | }
353 | },
354 | "har-schema": {
355 | "version": "2.0.0",
356 | "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
357 | "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI="
358 | },
359 | "har-validator": {
360 | "version": "5.1.5",
361 | "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz",
362 | "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==",
363 | "requires": {
364 | "ajv": "^6.12.3",
365 | "har-schema": "^2.0.0"
366 | }
367 | },
368 | "http-errors": {
369 | "version": "1.7.2",
370 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
371 | "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
372 | "requires": {
373 | "depd": "~1.1.2",
374 | "inherits": "2.0.3",
375 | "setprototypeof": "1.1.1",
376 | "statuses": ">= 1.5.0 < 2",
377 | "toidentifier": "1.0.0"
378 | }
379 | },
380 | "http-signature": {
381 | "version": "1.2.0",
382 | "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
383 | "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
384 | "requires": {
385 | "assert-plus": "^1.0.0",
386 | "jsprim": "^1.2.2",
387 | "sshpk": "^1.7.0"
388 | }
389 | },
390 | "httpntlm": {
391 | "version": "1.7.6",
392 | "resolved": "https://registry.npmjs.org/httpntlm/-/httpntlm-1.7.6.tgz",
393 | "integrity": "sha1-aZHoNSg2AH1nEBuD247Q+RX5BtA=",
394 | "requires": {
395 | "httpreq": ">=0.4.22",
396 | "underscore": "~1.7.0"
397 | }
398 | },
399 | "httpreq": {
400 | "version": "0.4.24",
401 | "resolved": "https://registry.npmjs.org/httpreq/-/httpreq-0.4.24.tgz",
402 | "integrity": "sha1-QzX/2CzZaWaKOUZckprGHWOTYn8="
403 | },
404 | "iconv-lite": {
405 | "version": "0.4.24",
406 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
407 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
408 | "requires": {
409 | "safer-buffer": ">= 2.1.2 < 3"
410 | }
411 | },
412 | "inherits": {
413 | "version": "2.0.3",
414 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
415 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
416 | },
417 | "ipaddr.js": {
418 | "version": "1.9.1",
419 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
420 | "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="
421 | },
422 | "is-typedarray": {
423 | "version": "1.0.0",
424 | "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
425 | "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
426 | },
427 | "isstream": {
428 | "version": "0.1.2",
429 | "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
430 | "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
431 | },
432 | "jsbn": {
433 | "version": "0.1.1",
434 | "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
435 | "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM="
436 | },
437 | "json-schema": {
438 | "version": "0.2.3",
439 | "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
440 | "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM="
441 | },
442 | "json-schema-traverse": {
443 | "version": "0.4.1",
444 | "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
445 | "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
446 | },
447 | "json-stringify-safe": {
448 | "version": "5.0.1",
449 | "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
450 | "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
451 | },
452 | "jsprim": {
453 | "version": "1.4.1",
454 | "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
455 | "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
456 | "requires": {
457 | "assert-plus": "1.0.0",
458 | "extsprintf": "1.3.0",
459 | "json-schema": "0.2.3",
460 | "verror": "1.10.0"
461 | }
462 | },
463 | "lodash": {
464 | "version": "4.17.20",
465 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
466 | "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
467 | },
468 | "media-typer": {
469 | "version": "0.3.0",
470 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
471 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
472 | },
473 | "merge-descriptors": {
474 | "version": "1.0.1",
475 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
476 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
477 | },
478 | "methods": {
479 | "version": "1.1.2",
480 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
481 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
482 | },
483 | "mime": {
484 | "version": "1.6.0",
485 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
486 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
487 | },
488 | "mime-db": {
489 | "version": "1.44.0",
490 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
491 | "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg=="
492 | },
493 | "mime-types": {
494 | "version": "2.1.27",
495 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
496 | "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
497 | "requires": {
498 | "mime-db": "1.44.0"
499 | }
500 | },
501 | "ms": {
502 | "version": "2.0.0",
503 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
504 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
505 | },
506 | "negotiator": {
507 | "version": "0.6.2",
508 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
509 | "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
510 | },
511 | "node-correios": {
512 | "version": "3.0.2",
513 | "resolved": "https://registry.npmjs.org/node-correios/-/node-correios-3.0.2.tgz",
514 | "integrity": "sha512-wlmd+5+UU8malGRXUuuU6jZRfkkrReMIvMmz8fzi0vkc+Jbv21n7T3eOE1NksSMVHZBsbXLNw3dovidU1SgY0Q==",
515 | "requires": {
516 | "request": "^2.67.0",
517 | "soap": "^0.29.0"
518 | }
519 | },
520 | "oauth-sign": {
521 | "version": "0.9.0",
522 | "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
523 | "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ=="
524 | },
525 | "on-finished": {
526 | "version": "2.3.0",
527 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
528 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
529 | "requires": {
530 | "ee-first": "1.1.1"
531 | }
532 | },
533 | "parseurl": {
534 | "version": "1.3.3",
535 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
536 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
537 | },
538 | "path-to-regexp": {
539 | "version": "0.1.7",
540 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
541 | "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
542 | },
543 | "performance-now": {
544 | "version": "2.1.0",
545 | "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
546 | "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
547 | },
548 | "proxy-addr": {
549 | "version": "2.0.6",
550 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz",
551 | "integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==",
552 | "requires": {
553 | "forwarded": "~0.1.2",
554 | "ipaddr.js": "1.9.1"
555 | }
556 | },
557 | "psl": {
558 | "version": "1.8.0",
559 | "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
560 | "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ=="
561 | },
562 | "punycode": {
563 | "version": "2.1.1",
564 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
565 | "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
566 | },
567 | "qs": {
568 | "version": "6.7.0",
569 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
570 | "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
571 | },
572 | "range-parser": {
573 | "version": "1.2.1",
574 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
575 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
576 | },
577 | "raw-body": {
578 | "version": "2.4.0",
579 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
580 | "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
581 | "requires": {
582 | "bytes": "3.1.0",
583 | "http-errors": "1.7.2",
584 | "iconv-lite": "0.4.24",
585 | "unpipe": "1.0.0"
586 | }
587 | },
588 | "readable-stream": {
589 | "version": "3.6.0",
590 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
591 | "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
592 | "requires": {
593 | "inherits": "^2.0.3",
594 | "string_decoder": "^1.1.1",
595 | "util-deprecate": "^1.0.1"
596 | }
597 | },
598 | "request": {
599 | "version": "2.88.2",
600 | "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
601 | "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==",
602 | "requires": {
603 | "aws-sign2": "~0.7.0",
604 | "aws4": "^1.8.0",
605 | "caseless": "~0.12.0",
606 | "combined-stream": "~1.0.6",
607 | "extend": "~3.0.2",
608 | "forever-agent": "~0.6.1",
609 | "form-data": "~2.3.2",
610 | "har-validator": "~5.1.3",
611 | "http-signature": "~1.2.0",
612 | "is-typedarray": "~1.0.0",
613 | "isstream": "~0.1.2",
614 | "json-stringify-safe": "~5.0.1",
615 | "mime-types": "~2.1.19",
616 | "oauth-sign": "~0.9.0",
617 | "performance-now": "^2.1.0",
618 | "qs": "~6.5.2",
619 | "safe-buffer": "^5.1.2",
620 | "tough-cookie": "~2.5.0",
621 | "tunnel-agent": "^0.6.0",
622 | "uuid": "^3.3.2"
623 | },
624 | "dependencies": {
625 | "qs": {
626 | "version": "6.5.2",
627 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
628 | "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
629 | }
630 | }
631 | },
632 | "safe-buffer": {
633 | "version": "5.1.2",
634 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
635 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
636 | },
637 | "safer-buffer": {
638 | "version": "2.1.2",
639 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
640 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
641 | },
642 | "sax": {
643 | "version": "1.2.4",
644 | "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
645 | "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
646 | },
647 | "send": {
648 | "version": "0.17.1",
649 | "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz",
650 | "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==",
651 | "requires": {
652 | "debug": "2.6.9",
653 | "depd": "~1.1.2",
654 | "destroy": "~1.0.4",
655 | "encodeurl": "~1.0.2",
656 | "escape-html": "~1.0.3",
657 | "etag": "~1.8.1",
658 | "fresh": "0.5.2",
659 | "http-errors": "~1.7.2",
660 | "mime": "1.6.0",
661 | "ms": "2.1.1",
662 | "on-finished": "~2.3.0",
663 | "range-parser": "~1.2.1",
664 | "statuses": "~1.5.0"
665 | },
666 | "dependencies": {
667 | "ms": {
668 | "version": "2.1.1",
669 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
670 | "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
671 | }
672 | }
673 | },
674 | "serve-static": {
675 | "version": "1.14.1",
676 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz",
677 | "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==",
678 | "requires": {
679 | "encodeurl": "~1.0.2",
680 | "escape-html": "~1.0.3",
681 | "parseurl": "~1.3.3",
682 | "send": "0.17.1"
683 | }
684 | },
685 | "setprototypeof": {
686 | "version": "1.1.1",
687 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
688 | "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
689 | },
690 | "soap": {
691 | "version": "0.29.0",
692 | "resolved": "https://registry.npmjs.org/soap/-/soap-0.29.0.tgz",
693 | "integrity": "sha512-eM+cnF6ZdJksMP94BdGoH4hxgMWxRLhJ7wVCY1nuSfeH7gsNZ6eGv8w+8BYZ8siQpJpM06gO08aU1KgdAm7qLQ==",
694 | "requires": {
695 | "@types/request": "^2.48.1",
696 | "bluebird": "^3.5.0",
697 | "concat-stream": "^2.0.0",
698 | "debug": "^4.1.1",
699 | "httpntlm": "^1.5.2",
700 | "lodash": "^4.17.15",
701 | "request": ">=2.9.0",
702 | "sax": ">=0.6",
703 | "serve-static": "^1.11.1",
704 | "strip-bom": "^3.0.0",
705 | "uuid": "^3.1.0",
706 | "xml-crypto": "^1.4.0"
707 | },
708 | "dependencies": {
709 | "debug": {
710 | "version": "4.2.0",
711 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
712 | "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==",
713 | "requires": {
714 | "ms": "2.1.2"
715 | }
716 | },
717 | "ms": {
718 | "version": "2.1.2",
719 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
720 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
721 | }
722 | }
723 | },
724 | "sshpk": {
725 | "version": "1.16.1",
726 | "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
727 | "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==",
728 | "requires": {
729 | "asn1": "~0.2.3",
730 | "assert-plus": "^1.0.0",
731 | "bcrypt-pbkdf": "^1.0.0",
732 | "dashdash": "^1.12.0",
733 | "ecc-jsbn": "~0.1.1",
734 | "getpass": "^0.1.1",
735 | "jsbn": "~0.1.0",
736 | "safer-buffer": "^2.0.2",
737 | "tweetnacl": "~0.14.0"
738 | }
739 | },
740 | "statuses": {
741 | "version": "1.5.0",
742 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
743 | "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
744 | },
745 | "string_decoder": {
746 | "version": "1.3.0",
747 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
748 | "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
749 | "requires": {
750 | "safe-buffer": "~5.2.0"
751 | },
752 | "dependencies": {
753 | "safe-buffer": {
754 | "version": "5.2.1",
755 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
756 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
757 | }
758 | }
759 | },
760 | "strip-bom": {
761 | "version": "3.0.0",
762 | "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
763 | "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM="
764 | },
765 | "toidentifier": {
766 | "version": "1.0.0",
767 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
768 | "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
769 | },
770 | "tough-cookie": {
771 | "version": "2.5.0",
772 | "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
773 | "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
774 | "requires": {
775 | "psl": "^1.1.28",
776 | "punycode": "^2.1.1"
777 | }
778 | },
779 | "tunnel-agent": {
780 | "version": "0.6.0",
781 | "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
782 | "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
783 | "requires": {
784 | "safe-buffer": "^5.0.1"
785 | }
786 | },
787 | "tweetnacl": {
788 | "version": "0.14.5",
789 | "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
790 | "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q="
791 | },
792 | "type-is": {
793 | "version": "1.6.18",
794 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
795 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
796 | "requires": {
797 | "media-typer": "0.3.0",
798 | "mime-types": "~2.1.24"
799 | }
800 | },
801 | "typedarray": {
802 | "version": "0.0.6",
803 | "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
804 | "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
805 | },
806 | "underscore": {
807 | "version": "1.7.0",
808 | "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz",
809 | "integrity": "sha1-a7rwh3UA02vjTsqlhODbn+8DUgk="
810 | },
811 | "unpipe": {
812 | "version": "1.0.0",
813 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
814 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
815 | },
816 | "uri-js": {
817 | "version": "4.4.0",
818 | "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz",
819 | "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==",
820 | "requires": {
821 | "punycode": "^2.1.0"
822 | }
823 | },
824 | "util-deprecate": {
825 | "version": "1.0.2",
826 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
827 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
828 | },
829 | "utils-merge": {
830 | "version": "1.0.1",
831 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
832 | "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
833 | },
834 | "uuid": {
835 | "version": "3.4.0",
836 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
837 | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="
838 | },
839 | "vary": {
840 | "version": "1.1.2",
841 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
842 | "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
843 | },
844 | "verror": {
845 | "version": "1.10.0",
846 | "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
847 | "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
848 | "requires": {
849 | "assert-plus": "^1.0.0",
850 | "core-util-is": "1.0.2",
851 | "extsprintf": "^1.2.0"
852 | }
853 | },
854 | "xml-crypto": {
855 | "version": "1.5.3",
856 | "resolved": "https://registry.npmjs.org/xml-crypto/-/xml-crypto-1.5.3.tgz",
857 | "integrity": "sha512-uHkmpUtX15xExe5iimPmakAZN+6CqIvjmaJTy4FwqGzaTjrKRBNeqMh8zGEzVNgW0dk6beFYpyQSgqV/J6C5xA==",
858 | "requires": {
859 | "xmldom": "0.1.27",
860 | "xpath": "0.0.27"
861 | }
862 | },
863 | "xmldom": {
864 | "version": "0.1.27",
865 | "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz",
866 | "integrity": "sha1-1QH5ezvbQDr4757MIFcxh6rawOk="
867 | },
868 | "xpath": {
869 | "version": "0.0.27",
870 | "resolved": "https://registry.npmjs.org/xpath/-/xpath-0.0.27.tgz",
871 | "integrity": "sha512-fg03WRxtkCV6ohClePNAECYsmpKKTv5L8y/X3Dn1hQrec3POx2jHZ/0P2qQ6HvsrU1BmeqXcof3NGGueG6LxwQ=="
872 | }
873 | }
874 | }
875 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "api-correios",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "express": "^4.17.1",
14 | "node-correios": "^3.0.2"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/server.js:
--------------------------------------------------------------------------------
1 | const express = require('express')
2 | const app = express()
3 |
4 | app.use(express.json())
5 |
6 | require('./src')(app)
7 |
8 | app.listen(3000, () => {
9 | console.log('Server started on port 3000!')
10 | })
11 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | module.exports = (app) => {
2 | app.use('/cep', require('./routes/cep'))
3 | app.use('/frete', require('./routes/frete'))
4 | }
5 |
--------------------------------------------------------------------------------
/src/routes/cep.js:
--------------------------------------------------------------------------------
1 | const express = require('express')
2 | const router = express.Router()
3 | const ApiNodeCorreios = require('node-correios')
4 |
5 | const correios = new ApiNodeCorreios()
6 |
7 | router.post('/', (request, response) => {
8 | const { cep } = request.body
9 |
10 | correios.consultaCEP({ cep }).then(result => {
11 |
12 | return response.json(result)
13 |
14 | }).catch(error => {
15 |
16 | return response.json(error)
17 |
18 | })
19 | })
20 |
21 | module.exports = router
22 |
--------------------------------------------------------------------------------
/src/routes/frete.js:
--------------------------------------------------------------------------------
1 | const express = require('express')
2 | const router = express.Router()
3 | const ApiNodeCorreios = require('node-correios')
4 |
5 | const correios = new ApiNodeCorreios()
6 |
7 | router.post('/', (request, response) => {
8 | const {
9 | nCdServico,
10 | sCepOrigem,
11 | sCepDestino,
12 | nVlPeso,
13 | nCdFormato,
14 | nVlComprimento,
15 | nVlAltura,
16 | nVlLargura,
17 | nVlDiametro,
18 | } = request.body;
19 |
20 | correios.calcPrecoPrazo({
21 | nCdServico,
22 | sCepOrigem,
23 | sCepDestino,
24 | nVlPeso,
25 | nCdFormato,
26 | nVlComprimento,
27 | nVlAltura,
28 | nVlLargura,
29 | nVlDiametro,
30 | }).then(result => {
31 |
32 | return response.json(result)
33 |
34 | }).catch(error => {
35 |
36 | return response.json(error)
37 |
38 | });
39 | })
40 |
41 | module.exports = router
42 |
--------------------------------------------------------------------------------