Skip to content

Commit 7da5fc5

Browse files
author
snippetbucket
committed
SnippetBucket.com confulence nodejs call rest
1 parent b95b7f7 commit 7da5fc5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

nodejs/test2.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const https = require('https');
2+
3+
https.get('https://192.168.1.119/rest/api/accessmode', (resp) => {
4+
let data = '';
5+
6+
// A chunk of data has been recieved.
7+
resp.on('data', (chunk) => {
8+
data += chunk;
9+
});
10+
11+
// The whole response has been received. Print out the result.
12+
resp.on('end', () => {
13+
console.log(JSON.parse(data).explanation);
14+
});
15+
16+
}).on("error", (err) => {
17+
console.log("Error: " + err.message);
18+
});

0 commit comments

Comments
 (0)