Page Contents

Home > @loopback/rest > RestServer > mountExpressRouter

RestServer.mountExpressRouter() method

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


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


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.