@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
36 lines (23 loc) • 1.03 kB
Markdown
---
lang: en
title: 'API docs: rest.compareroute'
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.compareroute.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/rest](./rest.md) > [compareRoute](./rest.compareroute.md)
## compareRoute() function
Compare two routes by verb/path for sorting
<b>Signature:</b>
```typescript
export declare function compareRoute(route1: Pick<RouteEntry, 'verb' | 'path'>, route2: Pick<RouteEntry, 'verb' | 'path'>): number;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| route1 | Pick<[RouteEntry](./rest.routeentry.md)<!-- -->, 'verb' \| 'path'> | First route entry |
| route2 | Pick<[RouteEntry](./rest.routeentry.md)<!-- -->, 'verb' \| 'path'> | Second route entry |
<b>Returns:</b>
number