0

How do I write a custom route? I'd like to write a route that returns 5 users (regardless of how many are in the database), but the available shorthands aren't cutting it.

I looked at the documentation, but I am still confused.

Sam Selikoff
  • 12,366
  • 13
  • 58
  • 104

1 Answers1

0

To write a custom route, simply pass a function in as the second argument to your route handler:

this.get('/users', function(db, request) {
  return db.users.filter(i => (i < 5));
});
Sam Selikoff
  • 12,366
  • 13
  • 58
  • 104