Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何编写自定义路线?我想编写一个返回 5 个用户的路由(无论数据库中有多少用户),但可用的速记并没有削减它。
我查看了文档,但我仍然感到困惑。
要编写自定义路由,只需将一个函数作为第二个参数传递给您的路由处理程序:
this.get('/users', function(db, request) { return db.users.filter(i => (i < 5)); });