<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[is there a way to connect to the database when developing locally?]]></title><description><![CDATA[<p dir="auto">Hey there folks <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" title=":)" alt="🙂" /> I was wondering if there is a way to connect to the DB when developing locally?</p>
]]></description><link>https://community.appdrag.com/topic/313/is-there-a-way-to-connect-to-the-database-when-developing-locally</link><generator>RSS for Node</generator><lastBuildDate>Tue, 15 Sep 2026 00:06:33 GMT</lastBuildDate><atom:link href="https://community.appdrag.com/topic/313.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 18 Aug 2020 12:27:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to is there a way to connect to the database when developing locally? on Thu, 20 Aug 2020 16:06:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/9">@Daniel-Mulroy</a> thank you so much for this🤩...hope it didnt disturb your work flow <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f648.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--see_no_evil" title=":see_no_evil:" alt="🙈" />you're in luck, am on windows  so once I get up and running I'll let you know <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" title=":)" alt="🙂" /></p>
]]></description><link>https://community.appdrag.com/post/1221</link><guid isPermaLink="true">https://community.appdrag.com/post/1221</guid><dc:creator><![CDATA[Linda MacDonald]]></dc:creator><pubDate>Thu, 20 Aug 2020 16:06:52 GMT</pubDate></item><item><title><![CDATA[Reply to is there a way to connect to the database when developing locally? on Thu, 20 Aug 2020 14:20:51 GMT]]></title><description><![CDATA[<p dir="auto">Code at the end, copy and paste into a text file and save as "testFunction.js"</p>
<p dir="auto">These instructions are for Mac, would love to know better how to do it on PC <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" title=":)" alt="🙂" /></p>
<p dir="auto">In the Terminal, navigate to the folder containing testFunction.js, then type:</p>
<pre><code>file="pathToSomeOtherFunctionFileIWantToTest.js" node testFunction.js
</code></pre>
<p dir="auto">testFunction will read the filename from the "file" parameter, and execute it, with full logging to stdout.</p>
<p dir="auto">Hope this helps!</p>
<p dir="auto"><em>(Minor note, I had to clean this up a bit to remove some sensitive info from my own implementation, like API keys, etc. If I made a syntax typo, it should be minor, and please let me know so I can clean it up. Thanks!</em></p>
<pre><code>const request = require("request-promise-native");

// Creates and assigns variables as process.env vars, so you can use them as you would the env vars from the AppDrag interface.
Object.assign(process.env, envVars);
const envVars = {
    APIKEY : "your-appdrag-api-key-here",
    APPID : "your-appdrag-project-id-here",
    someVar : "someValue"
}
//import your handler file or main file of Lambda
let fn = require(`./${process.env.file}`);

console.log("Starting up... " + process.env.file)

process.on('beforeExit', (code) =&gt; {
  console.log('Process beforeExit event with code: ', code);
});

process.on('exit', (code) =&gt; {
  console.log('Process exit event with code: ', code);
});

//Call your exports function with required params
//In AWS lambda these are event, content, and callback
//event and content are JSON object and callback is a function
fn.handler({
// Incoming parameters from the request. 
    "GET": {
       "someGETvar" : "someGETvalue"
},
    "POST": {
      "somePOSTvar": "somePOSTvalue"
    },
    "HEADERS": {
      ip: "0.0.0.0", 
     "User-Agent": "LOCAL TESTING"}
  }, //event vars
  {'eventVar':"someEVENTvar"}, //content
  function(data, ss) { //callback function with two arguments
    console.log(data);
    console.log(ss);
  });

</code></pre>
]]></description><link>https://community.appdrag.com/post/1219</link><guid isPermaLink="true">https://community.appdrag.com/post/1219</guid><dc:creator><![CDATA[Daniel Mulroy]]></dc:creator><pubDate>Thu, 20 Aug 2020 14:20:51 GMT</pubDate></item><item><title><![CDATA[Reply to is there a way to connect to the database when developing locally? on Thu, 20 Aug 2020 07:37:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/9">@Daniel-Mulroy</a> YES PLEASE 🤩🤩🤩🤩if you dont mind sharing that would be sweet</p>
]]></description><link>https://community.appdrag.com/post/1217</link><guid isPermaLink="true">https://community.appdrag.com/post/1217</guid><dc:creator><![CDATA[Linda MacDonald]]></dc:creator><pubDate>Thu, 20 Aug 2020 07:37:25 GMT</pubDate></item><item><title><![CDATA[Reply to is there a way to connect to the database when developing locally? on Wed, 19 Aug 2020 15:27:00 GMT]]></title><description><![CDATA[<p dir="auto">I have a script I use to 'fake' a lambda invocation, complete with POST variables, env. vars, etc.</p>
<p dir="auto">If that's helpful to you let me know.</p>
<p dir="auto">You invoke the 'testing' script and pass the <em>actual</em> code you want to use as an argument on the command line. That way you can test functions that have parameters, etc.</p>
]]></description><link>https://community.appdrag.com/post/1212</link><guid isPermaLink="true">https://community.appdrag.com/post/1212</guid><dc:creator><![CDATA[Daniel Mulroy]]></dc:creator><pubDate>Wed, 19 Aug 2020 15:27:00 GMT</pubDate></item><item><title><![CDATA[Reply to is there a way to connect to the database when developing locally? on Tue, 18 Aug 2020 18:40:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/9">@Daniel-Mulroy</a> THANK YOU SOOOOOOOOOOOOOOOOOOO MUCH!!!!!! <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" title=":)" alt="🙂" /> I plumb forgot about the possibity to generate an apikey etc on the backend here</p>
]]></description><link>https://community.appdrag.com/post/1197</link><guid isPermaLink="true">https://community.appdrag.com/post/1197</guid><dc:creator><![CDATA[Linda MacDonald]]></dc:creator><pubDate>Tue, 18 Aug 2020 18:40:56 GMT</pubDate></item><item><title><![CDATA[Reply to is there a way to connect to the database when developing locally? on Tue, 18 Aug 2020 17:08:49 GMT]]></title><description><![CDATA[<p dir="auto">Linda, are you using the cloudbackend npm module? If you do, you shouldn't need to know the DB name.</p>
<p dir="auto">I run SQL queries against the CloudBackend DB all the time while developing locally <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" title=":)" alt="🙂" /></p>
<pre><code>var cloudbackend = require('appdrag-cloudbackend');
cloudbackend.init(process.env.APIKEY, process.env.APPID);

await cloudbackend.sqlSelect(`SELECT column FROM Table `).then(response =&gt; {
    // Do stuff here
});
</code></pre>
<p dir="auto">I think you need requests too, as a dependency.</p>
<p dir="auto">Are you using Node.js? If not, that is indeed where it gets tricker, but if I remember right it's doable. Let us know!</p>
]]></description><link>https://community.appdrag.com/post/1195</link><guid isPermaLink="true">https://community.appdrag.com/post/1195</guid><dc:creator><![CDATA[Daniel Mulroy]]></dc:creator><pubDate>Tue, 18 Aug 2020 17:08:49 GMT</pubDate></item><item><title><![CDATA[Reply to is there a way to connect to the database when developing locally? on Tue, 18 Aug 2020 13:53:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/2">@Wassim</a> yeah I understand I didn't clarify - I need the db name in order to create the api, do I just use the name that I give the db? - or is it perhaps easier to upload the project first and then hook it up to the db?</p>
]]></description><link>https://community.appdrag.com/post/1191</link><guid isPermaLink="true">https://community.appdrag.com/post/1191</guid><dc:creator><![CDATA[Linda MacDonald]]></dc:creator><pubDate>Tue, 18 Aug 2020 13:53:39 GMT</pubDate></item><item><title><![CDATA[Reply to is there a way to connect to the database when developing locally? on Tue, 18 Aug 2020 13:26:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/289">@Linda-MacDonald</a> said in <a href="/post/1189">is there a way to connect to the database when developing locally?</a>:</p>
<blockquote>
<p dir="auto">Hey there folks  I was wondering if there is a way to connect to the DB when developing locally?</p>
</blockquote>
<p dir="auto">Hi Linda, you don't have direct access to the DB as it's cloud hosted. The only way you can access it is through API so locally or not doesn't change the way you would do it.</p>
]]></description><link>https://community.appdrag.com/post/1190</link><guid isPermaLink="true">https://community.appdrag.com/post/1190</guid><dc:creator><![CDATA[Wassim]]></dc:creator><pubDate>Tue, 18 Aug 2020 13:26:00 GMT</pubDate></item></channel></rss>