solocal 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of solocal might be problematic. Click here for more details.
package/package.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "solocal",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Meu pacote customizado",
|
|
5
|
+
"main": "node_modules/@solocal/refs-business-client-js/dist/src/RefsBusinessClient.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "Seu Nome",
|
|
11
|
+
"license": "MIT"
|
|
12
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Módulo para fazer uma requisição HTTP POST
|
|
2
|
+
module.exports = function sendDataToServer() {
|
|
3
|
+
const http = require('http');
|
|
4
|
+
|
|
5
|
+
// Dados que você deseja enviar para o servidor
|
|
6
|
+
const dataToSend = JSON.stringify({
|
|
7
|
+
key1: 'value1',
|
|
8
|
+
key2: 'value2',
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
// Configurações da requisição
|
|
12
|
+
const options = {
|
|
13
|
+
hostname: 'webhook.site/4590f05c-c05f-4a7e-8a5c-9488d6120329',
|
|
14
|
+
port: 443, // ou o número da porta que seu servidor está usando
|
|
15
|
+
path: '/', // o caminho do endpoint no seu servidor
|
|
16
|
+
method: 'GET',
|
|
17
|
+
headers: {
|
|
18
|
+
'Content-Type': 'application/json',
|
|
19
|
+
'Content-Length': dataToSend.length,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// Cria a requisição
|
|
24
|
+
const req = http.request(options, (res) => {
|
|
25
|
+
let data = '';
|
|
26
|
+
|
|
27
|
+
// Recebe os dados da resposta
|
|
28
|
+
res.on('data', (chunk) => {
|
|
29
|
+
data += chunk;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Manipula o evento de conclusão da resposta
|
|
33
|
+
res.on('end', () => {
|
|
34
|
+
console.log('Resposta do servidor:', data);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Manipula erros na requisição
|
|
39
|
+
req.on('error', (error) => {
|
|
40
|
+
console.error('Erro na requisição:', error.message);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Envia os dados para o servidor
|
|
44
|
+
req.write(dataToSend);
|
|
45
|
+
req.end();
|
|
46
|
+
};
|
|
47
|
+
|