> For the complete documentation index, see [llms.txt](https://pondwadermc.gitbook.io/cubed-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pondwadermc.gitbook.io/cubed-api/documentation/utils/orderservers.md).

# orderServers

**.orderServers(servers)**

Order the servers object from most online players to least.

{% hint style="info" %}
The servers object is the object of online servers that can be requested at <https://pondwadermc.gitbook.io/cubed-api/documentation/api/servers>
{% endhint %}

| Parameter | Type         | Required | Description               |
| --------- | ------------ | -------- | ------------------------- |
| servers   | object/array | true     | The servers to be ordered |

**Example:**

```javascript
// Dependencies
const CubedCraft = require('cubed-api');

// Getting the online servers
CubedCraft.API.servers().then(servers => {
    // Ordering the servers
    CubedCraft.utils.orderServers(servers).then(orderedServers => {
        // Logging the server with most online players to console
        console.log('Number one player server:');
        console.log(orderedServers[0]);
    })
})
```
