@absolunet/ioc2.1.0

View on GitHub

Server

HTTP server class that decorates Express server and router.

Members

methodOverrideParser :function

Source:
Method override parser callback accessor.

methodOverride :function

Source:
The method-override module.

express :Express

Source:
The Express module.

Methods

make(uniqueopt)

Source:
Make a new server instance.
Parameters:
Name Type Attributes Default Description
unique boolean <optional>
false Indicates that the servers hould be a unique one and not set as a singleton.
Returns:
Newly created Express server instance.
Type
Express

getInstance()

Source:
Get an existing server instance if exists or a fresh one otherwise.
Returns:
Existing or newly created Express server instance.
Type
Express

setDefaultInstance(server)

Source:
Set default server instance.
Parameters:
Name Type Description
server Express The Express server instance.
Returns:
The current server instance.
Type
http.services.Server

hasInstance()

Source:
Check if an instance already exists.
Returns:
Indicates that an Express server was already instantiated.
Type
boolean

getRouter()

Source:
Get Express router.
Returns:
Express router instance.
Type
express.Router

applyMiddleware(server)

Source:
Apply middleware to given server instance.
Parameters:
Name Type Description
server Express Express server instance.
Returns:
Express server instance with applied middleware.
Type
Express