Skip to content

Commit

Permalink
top ten route
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavfrid committed Dec 6, 2021
1 parent 297e539 commit f4b543d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ app.get('/lang/:lang', (req, res) => {
}
})

app.get('/top', (req, res) => {
const filteredData = data.sort((a, b) => b.average_rating - a.average_rating).slice(0, 10)
res.json(filteredData)
})

// Start the server
app.listen(port, () => {
// eslint-disable-next-line
Expand Down

0 comments on commit f4b543d

Please sign in to comment.