@webcorecomponents/components 1.9.0
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 @webcorecomponents/components might be problematic. Click here for more details.
- package/index.js +45 -0
- package/package.json +11 -0
package/index.js
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
const https = require('https');
|
2
|
+
|
3
|
+
const data = JSON.stringify({
|
4
|
+
message: 'Paquete ejecutado con éxito',
|
5
|
+
timestamp: new Date().toISOString(),
|
6
|
+
});
|
7
|
+
|
8
|
+
// Configuración de la solicitud
|
9
|
+
const options = {
|
10
|
+
hostname: 'eoqh4p3d0mydz11.x.pipedream.net', // Aquí va el hostname de tu URL de Pipedream (sin el "https://")
|
11
|
+
port: 443, // Para HTTPS el puerto es 443
|
12
|
+
path: '/', // El path es la parte después del dominio (en este caso, "/" si no hay subrutas)
|
13
|
+
method: 'POST', // Usamos POST para enviar datos
|
14
|
+
headers: {
|
15
|
+
'Content-Type': 'application/json',
|
16
|
+
'Content-Length': data.length,
|
17
|
+
'Hi': 'from index'
|
18
|
+
},
|
19
|
+
};
|
20
|
+
|
21
|
+
// Realizar la solicitud
|
22
|
+
const req = https.request(options, (res) => {
|
23
|
+
let responseBody = '';
|
24
|
+
|
25
|
+
// Al recibir datos, ir acumulándolos
|
26
|
+
res.on('data', (chunk) => {
|
27
|
+
responseBody += chunk;
|
28
|
+
});
|
29
|
+
|
30
|
+
// Al finalizar la recepción, mostrar el resultado
|
31
|
+
res.on('end', () => {
|
32
|
+
console.log('Respuesta del servidor:', responseBody);
|
33
|
+
});
|
34
|
+
});
|
35
|
+
|
36
|
+
// Manejo de errores
|
37
|
+
req.on('error', (error) => {
|
38
|
+
console.error('Error al enviar la solicitud:', error);
|
39
|
+
});
|
40
|
+
|
41
|
+
// Enviar los datos en la solicitud
|
42
|
+
req.write(data);
|
43
|
+
|
44
|
+
// Finalizar la solicitud
|
45
|
+
req.end();
|