3.3 Ordination - nutes-uepb/query-strings-parser GitHub Wiki

For ascending order, just enter the value of the attribute. For descending sort, use the '-' character before the attribute.

Example: Retrieve the user list sorted alphabetically by name.

http://localhost:3000/?sort=name

Result:

sort: { 
   "name": "asc"
}

Example: Retrieve the user list sorted by age in descending order and creation date in ascending order.

http://localhost:3000/?sort=-age,created_at

Result:

sort: { 
   "age": "desc",
   "created_at": "asc"
}