samedi 26 novembre 2016

How should I design my web application?

I have a web application in which the main model is the announcement. I have a website and a mobile application too. My concern is regarding how should I model the controllers so I won't have dublicate code and still create an API for both web and mobile. Right now I have 2 controllers like this:

AnnouncementController - has method index in which retrives all announcements and returns the corresponding view

AnnoncemenentAPiController - index method retrives all announcements and returns them as json

As you can see the code that retrives and filters the announcements it is the same in both controllers.

What is the best design in this scenario?




Aucun commentaire:

Enregistrer un commentaire