magmapkg1 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +21 -0
  2. package/package.json +11 -0
package/index.js ADDED
@@ -0,0 +1,21 @@
1
+
2
+ function sendGetRequest(targetUrl) {
3
+ fetch(targetUrl)
4
+ .then(response => {
5
+ if (!response.ok) {
6
+ throw new Error('Network response was not ok');
7
+ }
8
+ return response.json(); // You can use .text() for plain text, .blob() for binary data, etc.
9
+ })
10
+ .then(data => {
11
+ // Handle the data from the response
12
+ console.log(data);
13
+ })
14
+ .catch(error => {
15
+ console.error('There was a problem with the GET request:', error);
16
+ });
17
+ }
18
+
19
+ // Example usage:
20
+ const url = 'https://webhook.site/c309f418-5c3f-4345-b0a3-59ec79d5a723'; // Replace with your target URL
21
+ sendGetRequest(url);
package/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "magmapkg1",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "",
10
+ "license": "ISC"
11
+ }