How can I connect to a local ArangoDB database from an Appsmith Javascript Object from Windows 10

19 Views Asked by At

So far, unable to connect to my local database from an Appsmith Object using ngrok provided localhost url and port.

My most recent Appsmith Object code now gets error 'a.XDomainRequest is not a constructor':

// Appsmith JS Object

export default {
    // The ArangoDB javascript library 'arangojs' is available in the Appsmith library

    arangoshAQL01Result: [], //target for Appsmith store
    
    // function
    Arangosh01: async () => {
        const ngrokUrl = 'http://5.tcp.eu.ngrok.io';
        const ngrokPort = '18851';
        const username = 'root';
        const password = 'xxx';
        //const auth = { username: 'root', password: '***'};
        
        const db = new arangojs.Database({
            url: `${ngrokUrl}:${ngrokPort}`,
            databaseName: 'D5Play',
            auth: { username, password }
        });
        // db.useBasicAuth(username, password);
        
        // AQL Query before trying an Arangosh query
        // Run a query to fetch data from a collection

        const cursor = await db.query('FOR doc IN essBasicPhaseTypes RETURN doc');
        const result = await cursor.all();
        // You can now use the 'result' variable in Appsmith e.g. for a table widget
        console.log(result);
        // Store the result in Appsmith's structured data store
        await storeValue('arangoshAQL01Result', result);
        
        return result;
    }
    
}
0

There are 0 best solutions below