Backend to hook up with Ionic/ AngularJS


#1

Hi all,

I wanted to pick your thoughts on back end development.

I understand AngularJS has some inbuilt stuff to deal with backend like $http calls to say a SQL database? How do I alter codes dealing with a Firebase backend to a SQL backend?

$http and $resource are like php?
how about django, rails, java or even node.js?

Can anyone help guide me to some useful resources for me to change my code ? I need some demo app if preferably to study the codes!


#2

If you use Firebase, you’re in luck. AngularFire is a thing. See: https://www.firebase.com/docs/web/libraries/angular/quickstart.html

As for PHP, Java, Node, etc you just need to be able to accept an HTTP request. It’s just a normal AJAX call at the end of the day.

 $http.get('my/site/url/test.php',function(response){
 	//Do Stuff
 });

is roughly equivalent to…

var xhr = XMLHttpRequest;
xhr.onreadystatechange=function(){
	if (xmlhttp.readyState==4 && xmlhttp.status==200)
	{
		var response = xmlhttp.responseText;
		//Do Stuff
	}
}

xhr.open("GET","my/site/url/test.php",true);
xhr.send();

$http is just an abstraction with added promise support.

This tutorial may also help: http://mcgivery.com/ionic-using-factories-and-web-services-for-dynamic-data/


#3

thanks @andrewmcgivery. I have it now in Firebase but I hope to replace it with something else. Think Firebase does so much that I dont understand whats going on.

I need some guide as to how to do the replacement.