UrielCh / proxmox-api

TypeScript Api for proxmox
59 stars 15 forks source link

proxmoxApi is not a function #3

Closed Emiliaaah closed 3 years ago

Emiliaaah commented 3 years ago

When running the code from the example (with the for loop removed), here's an exact copy of the code I'm running:

require('dotenv').config();
const proxmoxApi = require("proxmox-api");

// authorize self signed cert if you do not use a valid SSL certificat
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

async function test() {
    // connect to proxmox
    const promox = proxmoxApi({host: process.env.HOST, password: process.env.PASSWORD, username: process.env.USER});
    // list nodes
    const nodes = await promox.nodes.$get();
    console.log(nodes)    
}

test().catch(console.error);

But when I run this code I get this error: TypeError: proxmoxApi is not a function

M1000fr commented 3 years ago

"proxmoxApi" is a function so do like this :

const { proxmoxApi } = require("proxmox-api");
Emiliaaah commented 3 years ago

Thanks! That worked.