Documentation / @zerotal/core / index / scanFileRoutes
Function: scanFileRoutes()
scanFileRoutes(
baseDir,reloadId?):Promise<number>
Defined in: router/FileRouter.ts:394
Scan baseDir for route files and register them with the global Router.
Called from Application.fileBasedRouting() during the boot phase.
Returns the number of individual method handlers registered.
Skipped files:
_middleware.tsfiles (middleware config, not routes)*.test.ts/*.spec.tsfiles- Any file with a leading underscore (
_*.ts) .d.tsdeclaration files
Registration order: file-based routes are registered during boot, before
routes/index.ts runs. Explicit routes registered afterward take precedence
(last write wins in Router.state.routes).
Parameters
baseDir
string
reloadId?
string
When provided (during a hot-reload), route and middleware
files are imported with ?t=<reloadId> appended so Bun
creates a fresh module namespace instead of returning the
cached version. Omit on first boot.
Returns
Promise<number>
The number of individual method handlers registered.