diff --git a/init/src/init.ts b/init/src/init.ts index 04640b73960..59490c88584 100644 --- a/init/src/init.ts +++ b/init/src/init.ts @@ -403,6 +403,7 @@ ${GRADIENT_CSS}`; import { define, type State } from "./utils.ts"; export const app = new App(); + app.use(staticFiles()); // this is the same as the /api/:name route defined via a file. feel free to delete this! @@ -421,7 +422,6 @@ const exampleLoggerMiddleware = define.middleware((ctx) => { app.use(exampleLoggerMiddleware); await fsRoutes(app, { - dir: "./", loadIsland: (path) => import(\`./islands/\${path}\`), loadRoute: (path) => import(\`./routes/\${path}\`), }); diff --git a/src/plugins/fs_routes/mod.ts b/src/plugins/fs_routes/mod.ts index 03add8d712b..9a7c985587b 100644 --- a/src/plugins/fs_routes/mod.ts +++ b/src/plugins/fs_routes/mod.ts @@ -47,6 +47,12 @@ function isFreshFile(mod: any): mod is FreshFsItem { } export interface FsRoutesOptions { + /** + * Parent directory for the `/routes` and `/islands` folders. + * + * By default, the `root` config option of the provided app is used. + * @default app.config.root + */ dir?: string; ignoreFilePattern?: RegExp[]; loadRoute: (path: string) => Promise;