UNPKG

@loopback/docs

Version:

Documentation files rendered at [https://loopback.io](https://loopback.io)

97 lines (48 loc) 1.76 kB
--- lang: en title: 'API docs: rest.restserver.mountexpressrouter' keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI sidebar: lb4_sidebar editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/rest permalink: /doc/en/lb4/apidocs.rest.restserver.mountexpressrouter.html --- <!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@loopback/rest](./rest.md) &gt; [RestServer](./rest.restserver.md) &gt; [mountExpressRouter](./rest.restserver.mountexpressrouter.md) ## RestServer.mountExpressRouter() method Mount an Express router to expose additional REST endpoints handled via legacy Express-based stack. **Signature:** ```typescript mountExpressRouter(basePath: string, router: ExpressRequestHandler, spec?: RouterSpec): void; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td markdown="1"> basePath </td><td markdown="1"> string </td><td markdown="1"> Path where to mount the router at, e.g. `/` or `/api`<!-- -->. </td></tr> <tr><td markdown="1"> router </td><td markdown="1"> ExpressRequestHandler </td><td markdown="1"> The Express router to handle the requests. </td></tr> <tr><td markdown="1"> spec </td><td markdown="1"> [RouterSpec](./rest.routerspec.md) </td><td markdown="1"> _(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. </td></tr> </tbody></table> **Returns:** void