NodeJS
NodeJS request method
get
https://neko-love.xyz
/api/v1/:endpoint
Get Endpoint

Example:

1
const { get } = require("https");
2
3
get("https://neko-love.xyz/api/v1/neko", (res) => {
4
const { statusCode } = res;
5
if (statusCode != 200) {
6
res.resume;
7
}
8
res.setEncoding("utf8");
9
let rawData = '';
10
res.on("data", (chunk) => {
11
rawData += chunk;
12
});
13
res.on("end", () => {
14
try {
15
const parsedData = JSON.parse(rawData);
16
console.log(parsedData);
17
} catch (e) {
18
console.error(e.message);
19
}
20
});
21
}).on("error", (err) => {
22
console.error(err.message);
23
});
Copied!
Last modified 1yr ago
Copy link