In order to test the different sorting algorithms, we will create a small express server, which will contain one endpoint to get a list of all books sorted by the number of pages in each of the books. In this example, we will start with an unordered list of books from a JSON file, which will serve as our data store.
In production applications, the sorting should be deferred to your database query and should not be done as a part of the application logic to avoid pain and confusion when dealing with scenarios such as filtering and paginated requests.