We have an API that allows us to return a list of notes at
/notes. We want to add the ability to sort that list by passing in the
sort query param, which we read off of
req.query. Once we know the expected sort order we pass a function to
Array.prototype.sort that compares two notes'
lastEdited values to decide which item comes first.
a item will be placed higher in the sorted array. If the function returns
b item will be placed higher.
View the source for this project on the projects github repo.