Override the count route
Last updated
Last updated
This example shows you how to override the count default route.
Forest Admin comes packaged with a set of existing routes, which execute Forest Admin's default logic. At installation, they are generated in /routes
.
An admin backend running on forest-express-sequelize
This directory contains the users.js
files where the routes are declared.
Forest Admin API is generating a default count query to manage the display and pagination of your data. To override the count route, simply remove the next()
statement and add your own logic.
The solution is to override this default query using an approximative count. If you don't need an exact count, it will be much faster to retrieve the data for your big tables: