Skip to main content

Server

@Plug(
stage
:BOOT_STAGE
name
:String
method
:Function
requiredOptional
:Boolean
)#

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
NameOptionalTypeDefaultsDescription
stageNoBOOT_STAGEBoot Stage where attached the plugin.
nameNoStringPlugin name
methodNoFunctionCallback Method where application create the configuration.
requiredYesBooleanfalseIs Required to Boot

Example

@Plug(BOOT_STAGES.BOOT_DEPENDENCIES, 'test', s => console.log, true)class Example extends Boot {}

@Pour(
Plugin
:ExpressiveTeaPlugin
)#

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
NameOptionalTypeDefaultsDescription
PluginNoExpressiveTeaPluginExpressive Tea Plugin Class

Example

@Pour(PluginClass)class Example extends Boot {}

@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
NameOptionalTypeDefaultsDescription
optionsYesExpressiveTeaServerProps{ port: 3000}Decorate application with user settings before start application

Example

@ServerSettings({    port: 8080})class Example extends Boot {}

@Static(
root
:BOOT_STAGE
virtualOptional
:String
optionsOptional
:ExpressiveTeaStaticFileServer
)#

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
NameOptionalTypeDefaultsDescription
rootNoBOOT_STAGEPath to start delivery resources.
virtualYesStringnullVirtual Path on Application Server
optionsYesExpressiveTeaStaticFileServer{}Static Server Options

Example

@Static('/assets')class Example extends Boot {}

@ExpressDirective(
name
:String
...settingsOptional
:*
)#

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
NameOptionalTypeDefaultsDescription
nameNoStringDirective Name from Express JS
...settingsYes*Directive Settings

Example

@ExpressDirective()class Example extends Boot {}

@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
NameOptionalTypeDefaultsDescription
settingNameNoStringDecorate Class Property with the [Setting Name] value or undefined.

Example

class Example {    @Setting('port')    port: number;}

@RegisterModule(
Module
:ExpressiveTeaModule
)#

Register Module Method Decorator this Method Decorator is used at bootstrap level and should decorate the start method with a Module Class.

Parameters
NameOptionalTypeDefaultsDescription
ModuleNoExpressiveTeaModuleA defined module class.

Example

class Example extends Boot {    @RegisterModule(ModuleClass)    async start() {        return super.start();    }}