Bun

Symbol

FileSystemRouter.constructor

constructor (options: { assetPrefix: string; dir: string; fileExtensions: string[]; origin: string; style: 'nextjs' }): FileSystemRouter

Create a new FileSystemRouter.

@param options

The options to use when creating the router

const router = new FileSystemRouter({
  dir: process.cwd() + "/pages",
  style: "nextjs",
});

const {params} = router.match("/blog/2020/01/01/hello-world");
console.log(params); // {year: "2020", month: "01", day: "01", slug: "hello-world"}

Referenced types