Server
)#
@Plug(Plug Class Decorator create a simple plugin to execute in one of the public stages defined on BOOT_STAGES, might be useful to attach a simple Express Server configuration.
Parameters
Name | Optional | Type | Defaults | Description | ||
---|---|---|---|---|---|---|
stage | No | BOOT_STAGE | Boot Stage where attached the plugin. | |||
name | No | String | Plugin name | |||
method | No | Function | Callback Method where application create the configuration. | |||
required | Yes | Boolean | false | Is Required to Boot |
Example
@Plug(BOOT_STAGES.BOOT_DEPENDENCIES, 'test', s => console.log, true)class Example extends Boot {}
Plugin:ExpressiveTeaPlugin)#
@Pour(From version 1.1.0 Expressive Tea allow using external plugins by installing the node package @expressive-tea/plugin
.
This plugin engine allows creates more complex plugin configuration and provision since allowing multi Boot Stage configuration
and check other plugin dependencies.
NOTE
In order to use this you will need to user the @expressive-tea/plugin package you can install it using npm install @expressive-tea/plugin --save
.
Parameters
Name | Optional | Type | Defaults | Description | ||
---|---|---|---|---|---|---|
Plugin | No | ExpressiveTeaPlugin | Expressive Tea Plugin Class |
Example
@Pour(PluginClass)class Example extends Boot {}
optionsOptional)#
@ServerSettings(Server Settings Singleton Class Decorator to Provide the Configuration to the server or another component on the projects, is working as a container to store user and library settings.
Parameters
Name | Optional | Type | Defaults | Description | ||
---|---|---|---|---|---|---|
options | Yes | ExpressiveTeaServerProps | { port: 3000} | Decorate application with user settings before start application |
Example
@ServerSettings({ port: 8080})class Example extends Boot {}
)#
@Static(Create a new middleware function to serve files from within a given root directory. The file to serve will be determined by combining req.url with the provided root directory. When a file is not found, instead of sending a 404 response, this module will instead call next() to move on to the next middleware, allowing for stacking and fall-backs. Check it out Express Static to more information.
Parameters
Name | Optional | Type | Defaults | Description | ||
---|---|---|---|---|---|---|
root | No | BOOT_STAGE | Path to start delivery resources. | |||
virtual | Yes | String | null | Virtual Path on Application Server | ||
options | Yes | ExpressiveTeaStaticFileServer | {} | Static Server Options |
Example
@Static('/assets')class Example extends Boot {}
name:String...settingsOptional:*)#
@ExpressDirective(Set or Update Express application settings, and allow to change the behavior of the server where is listed on the next link Express Settings as this is using the same principle of app.set you should understand that is only apply the special settings mentioned above. For more information please read this
Parameters
Name | Optional | Type | Defaults | Description | ||
---|---|---|---|---|---|---|
name | No | String | Directive Name from Express JS | |||
...settings | Yes | * | Directive Settings |
Example
@ExpressDirective()class Example extends Boot {}
settingName:String)#
@Setting(Setting Property Decorator Automatically assign a settings declared on Settings Service into the decorated property. All properties will contain the settings value or undefined if current settings is not founded.
Parameters
Name | Optional | Type | Defaults | Description | ||
---|---|---|---|---|---|---|
settingName | No | String | Decorate Class Property with the [Setting Name] value or undefined. |
Example
class Example { @Setting('port') port: number;}
Module:ExpressiveTeaModule)#
@RegisterModule(Register Module Method Decorator this Method Decorator is used at bootstrap level and should decorate the start method with a Module Class.
Parameters
Name | Optional | Type | Defaults | Description | ||
---|---|---|---|---|---|---|
Module | No | ExpressiveTeaModule | A defined module class. |
Example
class Example extends Boot { @RegisterModule(ModuleClass) async start() { return super.start(); }}