NodeJS

NodeJS request method

get
Get Endpoint

https://neko-love.xyz/api/v1/:endpoint
Request
Response
Request
Path Parameters
Parameter Type
required
string
The "endpoint" parameter must be a valid type
Response
200: OK
The answer is in JSON format like this
{
"url": "https://neko-love.xyz/v1/neko/neko-love_54.jpg"
}

Example:

const { get } = require("https");
‚Äč
get("https://neko-love.xyz/api/v1/neko", (res) => {
const { statusCode } = res;
if (statusCode != 200) {
res.resume;
}
res.setEncoding("utf8");
let rawData = '';
res.on("data", (chunk) => {
rawData += chunk;
});
res.on("end", () => {
try {
const parsedData = JSON.parse(rawData);
console.log(parsedData);
} catch (e) {
console.error(e.message);
}
});
}).on("error", (err) => {
console.error(err.message);
});