@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
81 lines (41 loc) • 1.3 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
**Signature:**
```typescript
export declare function compareRoute(route1: Pick<RouteEntry, 'verb' | 'path'>, route2: Pick<RouteEntry, 'verb' | 'path'>): number;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td markdown="1">
route1
</td><td markdown="1">
Pick<[RouteEntry](./rest.routeentry.md)<!-- -->, 'verb' \| 'path'>
</td><td markdown="1">
First route entry
</td></tr>
<tr><td markdown="1">
route2
</td><td markdown="1">
Pick<[RouteEntry](./rest.routeentry.md)<!-- -->, 'verb' \| 'path'>
</td><td markdown="1">
Second route entry
</td></tr>
</tbody></table>
**Returns:**
number