Page Contents

Home > @loopback/express > ExpressServer

ExpressServer class

An Express server that provides middleware composition and injection

Signature:

export declare class ExpressServer extends BaseMiddlewareRegistry implements Server 

Extends: BaseMiddlewareRegistry

Implements: Server

Constructors

Constructor Modifiers Description
(constructor)(config, parent)   Constructs a new instance of the ExpressServer class

Properties

Property Modifiers Type Description
basePath   string Base path to mount middleware
config?   ExpressServerConfig | undefined (Optional)
expressApp   express.Application Embedded Express application
httpServer   HttpServer HTTP/HTTPS server
listening   boolean Some of the methods below are copied from RestServer TODO(rfeng): We might want to refactor some methods from RestServer into the base ExpressServer.
rootUrl   string | undefined The root url for the server without the basePath. For example, the value will be ‘http://localhost:3000’ regardless of the basePath.
url   string | undefined The base url for the server, including the basePath if set. For example, the value will be ‘http://localhost:3000/api’ if basePath is set to ‘/api’.

Methods

Method Modifiers Description
getMiddlewareContext(request)   Retrieve the middleware context from the request
start()    
stop()