We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

multi mvc app + micro mvc app

I've got multi-module application that make use of database-mapped models. Also, i have to develop RESTful API that should make use of the same models. Obviously, API should be produced whit help of the micro mvc. But, how do i incorporate my micro mvc api into multi module mvc application? The thing that bothers me most is routes. How do i decide, which application should execute concrete route? What I need - is to make a desicion based on first placeholder in a route. For example, route api/v1_1/user/show/1157 should be executed by micro mvc app and regular/user/show/1157 should be executed by 'regular' module of multi mvc app and blind/user/show/1157 should be executed by 'blind' module of multi mvc app

edited Jul '15

I put inside a folder public/micros/midias.php

.htaccess

RewriteRule ^.*(gif|jpg|png|jpeg|bmp)$ micros/midias.php?_url=/$1 [NC,L,QSA]

An example to a api for midias that i have

In your case public/micros/api.php

RewriteRule ^/api(.*)$ micros/midias.php?_url=/$1 [NC,L,QSA]