How to create the server-side of a web app

1.7k views Asked by At

I am developing web app of my website with AppGyver (Steroids). The web is made with Laravel (PHP), and HTML, CSS and Javascript of course. I want to make an app with the same functionalities and a similar look. On of the problems is that I cannot use my current code because it is MVC and it uses the Laravel Blade Templating systems, so my views have PHP code inside, and PHP is not supported in web apps.

So I think that the correct way of make a mobile app is using Javascript / Ajax to make request to the server, to get the information variables that you have to show in the page. So first, I would like to know if this is the right way or I am wrong.

Secondly, I don't know if I can use my already made PHP, Laravel code. Of course, I cannot use the controllers which show views but the rest of them should work fine. So I don't know if I have to make a different Laravel project with new code, and copy some code that I can use from the web page or if I can develop some kind of structure to use the same project for the web page and mobile, so I can use my currents controllers and just create a few new ones, the ones which return information. So I would like to know which is the right way, creating a new project or adapt the current one for web and mobile.

Greetings and thanks.

PD: Link that you may need:

http://www.appgyver.com/

http://laravel.com/

1

There are 1 answers

3
shamon shamsudeen On BEST ANSWER

I think cordova is the best option for you.Using cordova you can create native mobile apps using HTML,CSS and JAVASCRIPT(android,ios,windows).Also you can use the same design pattern for both web and mobile.

For UI design

use either jquery mobile or ratchet (http://goratchet.com/).

For backend

use AJAX in jquery with JSON.here is an example code for the AJAX request

 $.ajax({
      url:'http://xxxx.in/admin/backend_db.php',
      success:function(data){

         alert("from server"+data)
      },
     error:function(err){
      alert(err);
     }

   });

If you want a flexible design and a cool look for your app ionicframework (http://ionicframework.com/) is the best.