How to create a connection to an external db with a Phonegap app?

2

I'm entering and studying the Phonegap / Cordova world and I want to start developing cooler and more interacting apps, but I'm finding this limitation in most places I find to learn, databases for apps using Phonegap / Cordova are local and I would like to know if it is possible to make an application using these tools (securely) with an external database and if so, how to do it.

obs: I already found questions with answers right here that said that it was possible to connect to the bank with JS, but on the other hand, it was not safe.

    
asked by anonymous 10.07.2016 / 14:22

2 answers

0

Directly on the client side you can not connect directly to the database.

On the server side, with javascript we have the NodeJS that makes this connection. Or you can use several other languages like ASP.NET, PHP, Java, Python, Ruby (on Rails) etc.

What is used is to create a WebService REST (easier) or WebSocket (less used) for the communication of the server with the client application.

Once you have the server, the client can communicate with http or websocket to exchange data with the server and so with the database.

There are several alternatives depending on the javascript framework you will be using if you are going to use one.

Look for WebServices and AJAX requests.

    
10.07.2016 / 14:28
0

Hello, a very cool option that makes this part of XHR and ajax transparent to you and has a whole back end at your disposal is the Firebase , a google service that can be accessed with javascript. Take a look there ..

    
14.07.2016 / 15:10