How to use modules with micro applications, as it does not have registerModules.
I recommend this forum reference code.
Modules are intented to be used with a dispatcher, so you need the full mvc, a micro application is not capable of running a module-based architecture
I need to build an API for already developed modular application, is there any workaround to achieve that?
Module-based applications require a dispatcher which a micro application lacks of, Maybe you can use a different namespace for those controller in the backend and those in the frontend loading from different directories.
<?php use Phalcon\Loader; $loader = new Loader(); $loader->registerNamespaces(array( 'Biko\Frontend\Controllers' => '../apps/frontend/controllers/', 'Biko\Backend\Controllers' => '../apps/backend/controllers/', )); $loader->register();
@Phalcon I think this is answer is not related to the question, re-phrasing my question again.
I already had developed a mutli module application, and I need to build a REST API on the top of this application and by having the benefits that the Micro application provides, any workaround for this?
@Conradaek It seems there is a miss-understanding, I don't want to build a new module for the API, I just need to provide an API for the already developed functionality regardless of the method used for implementation.
So, as I understand you, you have some app e.g. BalconyManagement app. Users can log in and add flowers which their plants on their balconies. There are flower forms, balcony forms etc.
And now you want to add API functionality so that user can do the same but communicating via URLs, e.g. for an Android app, so now adding a new flower will be possible via URL:
http://BalconyMgt.org/api/SomeUser/SomeMd5Pass/AddFlowerByName/MyBeautyRoseCharlie/ which will e.g. generate an output in JSON e.g. SUCCESS, flower added.
Am I right?
If I am right I think one of the solution will be to leave idea of REST API as a micro aplication and to build this REST API functionality as a new module. What do you think?
You are right, and I thought about building another module, but I wanted to use micro applications because of their features, so I was asking if there any workaround to do so?
Thanks alot for your help :).