Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Designing common server side for mobile and web application

I have a project where I should develop a mobile application(android) and a website. As both of them have the same database/content and functionality I want to write common sever side for mobile and web application.

Now I have two options:

  1. To develop a RESTful Web service on the server side to which my android app and website(HTML/Javascript) will communicate. I think it's not a comfortable way for website development, because you have fill all HTML components value using javascript on page load.

  2. Develop a web application with MVC framework (for example CodeIgniter) where each page will have two views:
    a) common HTML/CSS/Javascript page for Web site
    b) JSON data for mobile application. In this case mobile app will make a HTTP GET call to URL: www.mySite/someParameters and it'll respond JSON data as a result.

Which one is better to choose?
Or, Do you have any other suggestions?

like image 470
mariami Avatar asked Apr 15 '14 09:04

mariami


People also ask

Can we use same backend for mobile and web?

Yes a single backend should suffice. Now design of the backend should be flexible enough to accommodate all the possibilities.

What is server-side in web application?

The server-side code handles tasks like validating submitted data and requests, using databases to store and retrieve data and sending the correct data to the client as required.

What type of server that provides servers to mobile apps?

An application server is a software framework that delivers content and assets for a client application. Clients include web-based applications, browsers, and mobile apps. Application servers provide clients with access to business logic.


1 Answers

I prefer build a web application in this way:

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

  3. Use some client side framework I prefer boostrap to have a responsive layout.

  4. Use an MVC client side, like knockoutjs.com.

  5. AJAX calls, where I call the url /hello I map the result to knockoutjs binding, in this way I have a bidirectional binding.

  6. Build a native application for Android or iPhone using the interfaces.

    I hope it can be useful

like image 56
Gabriele Santomaggio Avatar answered Sep 29 '22 13:09

Gabriele Santomaggio