PFRF Backend Module Registry

Backed Module Registry is responsible for register Controller & Model of the module. This registry will connect with the base registry for put the Controller & Model to the application Controller & Model pool.


Example Module Registry

class ModuleNameRegistry:

    def register_model(self, flask_app):
        pass

    def register_controller(self, flask_app):
        pass


module_name_registry = ModuleNameRegistry()
Here
  • register_model : Place all the Model of the module

  • register_controller : Place all the Controller of the module


Example Module Registry with data

from item.controller.item_controller import item_controller
from item.model.item import database as item_model


class ItemRegistry:

    def register_model(self, flask_app):
        item_model.create_all()

    def register_controller(self, flask_app):
        flask_app.register_blueprint(item_controller)


item_registry = ItemRegistry()
Here
  • ItemRegistry : Because Item is the module name

  • item_model : Item model definition

  • item_controller : Item Controller Blueprint name.