fcf.NServer.Application class

A singleton of the application object on the server, accessible through the fcf.application object

Class description Methods
fcf.Context createSystemContext(string | [string] a_groups, string | [string] a_roles) - Creates a system context object with the specified groups and roles.
fcf.NSystem.Configuration getConfiguration() - Returns the application configuration object
fcf.NSystem.Cron getCron() - Returns an object for performing scheduled tasks, similar to CRON
fcf.EventChannel getEventChannel() - Returns the application message channel object
object getPackages() - Returns an object containing packages loaded in the system as fcf.NSystem objects.NPackage.Package, and the package name acts as the key.
fcf.NFSQL.Projections getProjections() - Returns an object that stores the projection of the application
fcf.NRender.Render getRender() - Returns an internal render object
fcf.NServer.Router getRouter() - Returns the application router object
fcf.NFSQL.Storage getStorage() - Returns an object of accessing the database through the projection mechanism and the FSQL language
fcf.Actions getSystemActions() - Returns the system actions object. Unlike < apifunction>fcf. actions() getSystemActions blocks the application from restarting until the operations are completely completed.
fcf.Context getSystemContext() - Returns the system context
mixed getSystemVariable(string a_package, string a_name) - Returns the value of a system variable. mixed getSystemVariable(srtring a_path) - Returns the value of a system variable.
fcf.Actions initialize() - Initializes the server application.
boolean isRun() - Returns the value of the server - application startup flag
fcf.Actions->mixed loadSystemVariable(string a_package, string a_name) - [Asynchronous method] Returns the current value of the system variable via a query in the database, bypassing the cache. fcf.Actions->mixed loadSystemVariable(string a_path) - [Asynchronous method] Returns the current value of the system variable via a query in the database, bypassing the cache.
fcf.Actions->fcf.NRender.Template render(object a_options) - [Asynchronous method] Renders the template and returns the result as a fcf.NRender.Template object
fcf.Action run() - Executes the application launch
fcf.Actions setSystemVariable(string a_package, string a_name, mixed a_value) - [Asynchronous method] Sets the value of an existing system variable. System variables are created via the configuration parameter systemVariables fcf.Actions setSystemVariable(string a_path, mixed a_value) - [Asynchronous method] Sets the value of an existing system variable. System variables are created via the configuration parameter systemVariables
Methods
fcf.Context createSystemContext(string | [string] a_groups, string | [string] a_roles) Creates a system context object with the specified groups and roles. Arguments: string | [string] a_groups - Group name or array of groups string | [string] a_roles - Role name or array of roles Return value: fcf.Context System context object
fcf.NSystem.Configuration getConfiguration() Returns the application configuration object Return value: fcf.NSystem.Configuration Application config object
fcf.NSystem.Cron getCron() Returns an object for performing scheduled tasks, similar to CRON Return value: fcf.NSystem.Cron
fcf.EventChannel getEventChannel() Returns the application message channel object Return value: fcf.EventChannel
object getPackages() Returns an object containing packages loaded in the system as fcf.NSystem objects.NPackage.Package, and the package name acts as the key. Return value: object An object containing the fcf.NSystem.NPackage.Package objects, and the package name acts as the key.
fcf.NFSQL.Projections getProjections() Returns an object that stores the projection of the application Return value: fcf.NFSQL.Projections Object storing application projections
fcf.NRender.Render getRender() Returns an internal render object Return value: fcf.NRender.Render Internal render object
fcf.NServer.Router getRouter() Returns the application router object Return value: fcf.NServer.Router Router object
fcf.NFSQL.Storage getStorage() Returns an object of accessing the database through the projection mechanism and the FSQL language Return value: fcf.NFSQL.Storage The object of accessing the database through the projection mechanism and the FSQL language
fcf.Actions getSystemActions() Returns the system actions object. Unlike < apifunction>fcf. actions() getSystemActions blocks the application from restarting until the operations are completely completed. Return value: fcf.Actions
fcf.Context getSystemContext() Returns the system context Return value: fcf.Context System context as root
mixed getSystemVariable(string a_package, string a_name) mixed getSystemVariable(srtring a_path) Returns the value of a system variable. Arguments: string a_package - The name of the package in which the system variable is stored string a_name - System variable name srtring a_path - The path of the system variable, where the package name and the variable are separated by a colon. Example: "fcf:DefaultLanguage" Return value: mixed
fcf.Actions initialize() Initializes the server application. Return value: fcf.Actions Examples Example 1 Example of the main application file that uses the initialize() method const fcf = require("fcf"); fcf.application.initialize() .then(async ()=>{ return fcf.application.run(); }) .catch((a_error)=>{ fcf.log.err("APPLICATION", a_error); })
boolean isRun() Returns the value of the server - application startup flag Return value: boolean
fcf.Actions->mixed loadSystemVariable(string a_package, string a_name) fcf.Actions->mixed loadSystemVariable(string a_path) [Asynchronous method] Returns the current value of the system variable via a query in the database, bypassing the cache. Arguments: string a_package - Package name string a_name - System variable name string a_path - The path of the system variable, which includes the package name and the variable name separated by a character : Return value: fcf.Actions->mixed Returns the fcf.Actions object, which stores the selection result at the end of the method.
fcf.Actions->fcf.NRender.Template render(object a_options) [Asynchronous method] Renders the template and returns the result as a fcf.NRender.Template object Arguments: object a_options - An object containing rendering parameters:

string template - Template path or alias.

object args - template arguments

fcf.RouteInfo route - [default = context.route] route object

fcf.Context context - [default = fcf.getContext()] context object

Return value: fcf.Actions->fcf.NRender.Template Render result object Examples Example 1 An example of rendering a button: let buttonTemplate = await fcf.application.render({ template: "@controls:button", args: { title: "Click me" } });
fcf.Action run() Executes the application launch Return value: fcf.Action Examples Example 1 Example of the main application file that uses the run() method const fcf = require("fcf"); fcf.application.initialize() .then(async ()=>{ return fcf.application.run(); }) .catch((a_error)=>{ fcf.log.err("APPLICATION", a_error); })
fcf.Actions setSystemVariable(string a_package, string a_name, mixed a_value) fcf.Actions setSystemVariable(string a_path, mixed a_value) [Asynchronous method] Sets the value of an existing system variable. System variables are created via the configuration parameter systemVariables Arguments: string a_package - Package name string a_name - System variable name mixed a_value - New value for the system variable string a_path - The path of the system variable, which includes the package name and the variable name separated by a character : Return value: fcf.Actions