Welcome Guest, Not a member yet? Register   Sign In
[SOLVED]Web and mobile via same backend
#2

(10-16-2015, 04:57 AM)PureTryOut Wrote: I'm not sure how to start with this, maybe one of you has a suggestion.

Basically I'm going to create a website, and a mobile application (Android, iOS, doesn't matter), which both have to talk via the same PHP backend. This backend interacts with the database.
So I want the frontend (so the website + mobile application) to send some sort of "command" to the backend. The backend then does something depending on the command it gets, and returns a value (I guess JSON would be the easiest here).

Should I create a seperate project for the backend, and call it from the frontend via a CURL call, or something like that? Or should I create the backend in the same project as the frontend, but seperate the controllers in different folders, and call the backend directly? I would think the latter is better for performance and security, but I don't know how to call one controller from the other, if that is even possible.

Not sure if I'm really clear so an image to describe what I mean:
[Image: 5NSTNC.svg]

Hi,

I recommend you the following structure:


- controllers
  - backend/
  - frontend/
  - api/
- models
- views
  - backend/
  - frontend/

With this structure you can share and reuse the models, this is interesting because a lot of data will be the same, then you don't repeat the code.

For api you can't extend from REST_Controller from codeigniter-restserver that is very easy to use and powerful.
Greetings.
Reply


Messages In This Thread
RE: Web and mobile via same backend - by rtorralba - 10-16-2015, 07:37 AM
RE: Web and mobile via same backend - by mwhitney - 10-16-2015, 09:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB