Skip to content

Commit c11cf7b

Browse files
feat: expose layouts and pages on App (#3086)
This PR extracts the functionality from the `fs_routes` plugin and exposes it onto `App`. These are the new APIs: - `app.layout(pattern, route)` - `app.onError(pattern, route)` - `app.notFound(pattern, route)` - `app.route(pattern, route)` This also removes the need for `.use(staticFiles())`. This line can be safely removed. Fixes #3040 Fixes #3033 Fixes #2591 Fixes #950 Fixes #1918
1 parent ccb621d commit c11cf7b

35 files changed

+1323
-966
lines changed

init/src/init.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,11 @@ ${GRADIENT_CSS}`;
360360
// Skip this and be silent if there is a network issue.
361361
}
362362

363-
const MAIN_TS = `import { App, fsRoutes, staticFiles } from "fresh";
363+
const MAIN_TS = `import { App, fsRoutes } from "fresh";
364364
import { define, type State } from "./utils.ts";
365365
366366
export const app = new App<State>();
367367
368-
app.use(staticFiles());
369-
370368
// this is the same as the /api/:name route defined via a file. feel free to delete this!
371369
app.get("/api2/:name", (ctx) => {
372370
const name = ctx.params.name;

0 commit comments

Comments
 (0)