Page Contents

Home > @loopback/rest > RestApplication > route

RestApplication.route() method

Register a new route.

Signature:

route(route: RouteEntry): Binding;

Parameters

Parameter Type Description
route RouteEntry The route to add.

Returns:

Binding

Example

function greet(name: string) {
 return `hello ${name}`;
}
const route = new Route('get', '/', operationSpec, greet);
app.route(route);