lundi 27 août 2018

Good practice: API and MVC - where should I put method / function with SQL query for API

I've done project according to MVC pattern, now I'm looking to add API. I have a separate package for the myresource, and this package contains functions that should return data in JSON (just placeholder text for now). Now I am at the moment where I want to create function/method with the MySQL query and return requested data from MySQL DB. I want to create another method within my model file to keep MVC pattern. However, I do not know, for API should I crate this function in the API servlet or is it good to place this in the model and keep API servlet only to return requested data?

Aucun commentaire:

Enregistrer un commentaire