The Controller Unit
Loads controllers from the specified directory and creates an access function for them. It makes these available as the
Controller context and calls the next function in the stack under it.
constructor(String controller_directory = './app/controllers')
Initializes the class. Resolves the fully-qualified path from the provided
controller_directory and stores it in
go(express app, function next)
Iterates over files in
this.directory and retrieves the controller classes from them. Stores them in
_flit.controllers.definitions in key-value pairs, where the key is the name of the controller and the value is an instance of the class. The names are parsed from the file names and use Flitter's convention for sub-directory naming. Creates a function to access these instances and makes it available at
_flit.controllers.controller(). These establish the
Controller context and then the
next function in the stack is called under it.
Object describing the services, templates, and directories provided by this unit. They are as follows:
||The name of the service. This is added to the
||The fully-qualified path of the config files. This is added to the
||Template that creates new config file in
Set on initialization. Specifies the fully-qualified path of the controller class files to be processed. Each of these files should export a class of request-handling methods. Each file's class is assigned a name based on the name of the file it was retrieved from. This includes sub-directories. As is convention in Flitter, sub-directories are delineated with a
: character. So a controller class loaded from the file
auth/Login.controller.js would be named
This context provides access to instances of the controller classes by name, as well as the global access function,
Holds the variables and functions provided by this unit.
A collection of key-value pairs such that they keys are the names of the controllers parsed from the files in the specified directory. These names follow the Flitter convention for sub-directory naming. The values are instances of the corresponding controller classes.
Access function that returns the controller from
_flit.controllers.definitions with the corresponding