Now, let's create the endpoint, which uses Mergesort to sort and return our data based on the page count.