Marvin Hagemeister
c11cf7b41a
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 https://github.com/denoland/fresh/issues/3040
Fixes https://github.com/denoland/fresh/issues/3033
Fixes https://github.com/denoland/fresh/issues/2591
Fixes https://github.com/denoland/fresh/issues/950
Fixes https://github.com/denoland/fresh/issues/1918
2025-07-14 19:27:48 +02:00
Christian Svensson
a23596153b
fix: allow Data to be inferred from Handler function ( #2916 )
...
This PR adds support for single-function GET handler data to be inferred
when using `define.page<typeof handler>()`.
```ts
export const handler = define.handlers((ctx) => {
return page({ foo: "foo" });
});
export default define.page<typeof handler>((ctx) => {
ctx.data; // Correctly resolves as { foo: string }
});
```
This PR also adds a test that checks that the types inferred are correct
by type checking.
2025-05-12 09:41:28 +02:00
Luca Casonato
c3ec742a65
feat: import fresh from fresh ( #2479 )
...
Instead of importing as `@fresh/core`.
2024-06-05 14:51:35 +02:00
Luca Casonato
8d85945da6
fix: remove Data from FreshContext ( #2473 )
...
This is now only on `PageProps`.
2024-05-31 13:50:28 +02:00
Luca Casonato
f2162d24bf
feat: add render function ( #2454 )
2024-05-24 18:31:34 +02:00
Luca Casonato
c9f0ccdce7
feat: rename helpers to define ( #2453 )
2024-05-24 11:48:32 +02:00