Development of a common server part for mobile and web applications

I have a project where I have to develop a mobile application (Android) and a website. Since both of them have the same database / content and functionality , I want to write a common side for mobile and web applications.

Now I have two options:

  • To create a server-side RESTful web service to which my Android app and website (HTML / Javascript) will contact. I think this is not a convenient way to develop the site, because you filled in all the values ​​of the HTML components using javascript to load the page.

  • Develop a web application with an MVC framework (e.g. CodeIgniter), where each page will have two views:
    a) general HTML / CSS / Javascript page for website
    b) JSON data for the mobile application. In this case, the mobile application will make an HTTP GET call for the URL: www.mySite / someParameters, and as a result, it will respond to JSON data.

Which one is better to choose?
Or do you have other suggestions?

+7
web-applications architecture server-side software-design mobile-application
source share
2 answers

I prefer to create a web application this way:

  • Web application with java Spring
  • Create a REST interface, usually with two outputs, JSON and XML, for example http://localhost:8080/hello and http://localhost:8080/greeting.xml

  • Use some client-side frameworks. I prefer boostrap to have a responsive layout.

  • Use the MVC client side, for example knockoutjs.com .

  • AJAX calls where I call url / hello. I am matching the result with knockoutjs binding, so I have a bi-directional binding.

  • Create your own application for Android or iPhone using interfaces.

    I hope this can be useful

+6
source share

The answer depends on (a) how comfortable you are with any solution and (b) the requirements of the project. I would prefer (1) because I don’t know any web frameworks, but I am very familiar with network programming. It would be easy to write some kind of application in the background that serves an HTML page. However, if it was a large project, then it would be advantageous to choose (2).

If you just want to do something and you don’t see any advantage / disadvantage for any solution, just select it.

0
source share

All Articles