Node.js

Here is an example of how to make a simple request in NodeJS

var fetchUrl = require("fetch").fetchUrl;

const payload = {
    proxies: {
        useproxy: false
    },
    url: "https://api.myip.com/",
    method: "GET",
    headers: {},
    client: 1,
    protocol: "HTTP/2.0",
    redirect: false,
    timeout: 10
}

fetchUrl("http://127.0.0.1:8080/api/v4/flclient", {
    method: "POST",
    headers: {
        'Content-Type': "application/json",
        'Authorization': "Bearer xxxx-xxxx"
    },
    payload: JSON.stringify(payload)
}, (err, m, body) => {
    if(err) {
        console.log("Error fetching data:", e)
        return;
    }
    
    console.log(body.toString())
});

Last updated