New to IONIC frame work

Hi, i am new to IONIC and need to get clarification on the following:

i want to develop ANDROID MOBILE APPS in windows environment and connect to database postgres.
Now i have installed the framework and want to know how to connect to the postgres database.

please advise.


Ionic, and Cordova for that matter, has nothing to do with your backend. To connect to Postgres you’ll need to create RESTful APIs and use AngularJS services to interact with the backend.

Hi @adamsilver,

i’m in the same boat here, i’ve actually built out a frond end with some scaffold data using ionic - a tabbed based app that displays real estate listings.

Now i’m looking for information on how to wire this up to a backend that is going to have dynamic data. I’m thinking of using Heroku with Postgres for the DB. I understand that i need to create node.js api’s for the app to work with but i’m actually having trouble finding any decent tutorials on how this is all wired together.

If you’ve got any references to some documentation etc, could you please post them here? I would be appreciative!


as @adamsilver already mentioned, you can use AngularJS services (eg. $http) to connect to your backend.

// service
angular.module('yourapp').service('YourBackendService', function($http) {
    return {
        getData: function() {
              // each $http function returns a promise
              return $http.get('');
// controller
angular.module('yourapp').controller('yourCtrl', function(YourBackendService) {
    YourBackendService.getData().then(function(result) {
        // do something with your data
    }).catch(function(err) {
        // something went wrong

You can also inject $http (and other services) directly inside a controller if you want to.

Hi @timoweiss, sorry for the misunderstanding here… i did understand that piece, however what i’m trying to figure out is how to create the backend itself.

I would like to be able to interact with Postgresql running on Heroku. Still reading on this topic, it looks like I need to create a node server that exposes API’s to the Postgres DB - but I can’t find any intro documentation on this at all…

Ah ok, got it.
I personally prefer hapi.js as a backend framework (scroll down a bit to see how easy it is to offer/register routes for your app). If’ve never done something with postgres but there are several node-modules out there, eg.

thanks @timoweiss! I’ve learnt considerably since that last post… i’ve built out a node server running on heroku that creates the API’s for the app to call…

once i’m finished this bit of work (building a demo for a customer), i’ll post out the heroku button so that people can deploy a back end with a click :slight_smile:

How did you connect with Heroku Postgre database? I have a node server running on heroku and I need to use heroku postgre database.

Hi @KowsalyaPK,

I’ve just logged back in here and seen this - did you get sorted? I have a git repo that can show you how I did it, I used pg-promise :slight_smile: