Sort using FrontQL
Introduction
In web applications, it is common to sort data in ascending or descending order. FrontQL provides the ability to sort data using the sort query parameter.
Implementing Sort
- The
sortquery parameter is used to specify the sort order.
Example
Here’s a simple example of implementing sort using FrontQL:
async function getUsers() { const response = await Api.get("/users", { sort: "-created_at", });
return response;}This example uses the
sortquery parameter to sort the data in descending order based on thecreated_atfield.