Using a REST API for front-end code is a desiderable and quite common practice.
However, I was wondering if using it also for the back-end could be a good choice.
What I mean is leaving the burden of retrieving data from the database all to the API, and then call it from other parts of my back-end (mainly views and controllers) whenever I need to query the database, instead of doing it directly.
One thing I'm really concerned about is sharing some code between front-end and back-end, and using the API as a common source of data would be very handy.
So the question is, are there some reasons which make this a bad idea?