Page Contents

Home > @loopback/express > ExpressServer

ExpressServer class

An Express server that provides middleware composition and injection


export declare class ExpressServer extends BaseMiddlewareRegistry implements Server 

Extends: BaseMiddlewareRegistry

Implements: Server


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


Property Modifiers Type Description
basePath readonly string Base path to mount middleware
config? <p>protected</p><p>readonly</p> ExpressServerConfig | undefined (Optional)
expressApp readonly express.Application Embedded Express application
httpServer protected HttpServer HTTP/HTTPS server
listening readonly 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 readonly 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 readonly 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’.


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