CreateFileBasedRouter API
createFileBasedRouter creates a router based on the files and directories in your application’s routes directory.
It scans your route files, converts them into routes, and provides the routing functionality used by UFBR.
Ufbr is configured by passing an options object to createFileBasedRouter.
createFileBasedRouter({ target, pages})| Option | Type | Description |
|---|---|---|
pages |
Record<string, () => Promise<any>> |
Page modules generated by import.meta.glob(). The object keys are used to determine the file-based routes. |
target |
HTMLElement | Element |
The DOM element where the router renders the current page. |