As I understand, a RESTful API aims to provide a communication layer for building on top of an application. Could the core application be build using the same REST logic?
So for example, build the REST architecture, and then implement all the database operations (CRUD) based on REST.
Therefore in an MVC application we have some controllers for implementing the REST service, like:
function Users(user_id){
\\ return user with id = user_id
}
function Articles (article_id){
\\ return article with id = article_id
}
And some controllers for handling the presentation. So if for example we want to list some articles in the homepage:
function homepage (){
for ($i=0; $i<10; $i++)
{
\\ request 'http://www.example.com/articles/' . $some_article_id;
}
\\ output to view
}
Not sure if the above makes sense, but the main point is that we add another layer in the MVC architecture, so that the presentation-logic Controllers no longer communicate directly with the models, but only through the REST Controllers:
In an MVC approach the data flow is:
presentation Controller ----> Model ----> presentation Controller ----> View
In an MVC - REST approach the data flow would be:
presentation Controller ----> REST Controller ----> Model ----> REST Controller ----> presentation Controller ----> View
Do you see any disadvantages in the above approach? I believe that it would simplify coding but I searched a lot and haven't found any further info.