Page Contents

Home > @loopback/rest > RestApplication > mountExpressRouter

RestApplication.mountExpressRouter() method

Mount an Express router to expose additional REST endpoints handled via legacy Express-based stack.

Signature:

mountExpressRouter(basePath: string, router: ExpressRequestHandler, spec?: RouterSpec): void;

Parameters

Parameter Type Description
basePath string Path where to mount the router at, e.g. / or /api.
router ExpressRequestHandler The Express router to handle the requests.
spec RouterSpec (Optional) A partial OpenAPI spec describing endpoints provided by the router. LoopBack will prepend basePath to all endpoints automatically. This argument is optional. You can leave it out if you don’t want to document the routes.

Returns:

void