Connecting to node.js backend using Cordova

143 views Asked by At

I am trying to build an iOS and Android (hybrid app) using Cordova, where the app will be using the HTML framework for front end, and node.js backend. However, I cannot figure out the folder/file structure of Cordova basic application, and where to put node.js code.

could someone please point me in the direction of how to connect my front end code with backend (node.js) code in cordova?

My app structure currently sites like:

myApp
node_modules
platforms
plugins
www

and in www, I have a js folder, but it contains only an index.js file, with:

document.addEventListener('deviceready', onDeviceReady, false);

function onDeviceReady() {
    // Cordova is now initialized. Have fun!

    console.log('Running cordova-' + cordova.platformId + '@' + cordova.version);
    document.getElementById('deviceready').classList.add('ready');
}

so I am confused, how do I write my node.js code where I can connect to my database, create routes, etc, like you would in a web app?

0

There are 0 answers