feat: support async app template (#1626)
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
This commit is contained in:
co-authored by
Asher Gomez
parent
563b61d849
commit
ba67d895ce
@@ -0,0 +1,25 @@
|
||||
import { delay } from "$std/async/delay.ts";
|
||||
import { AppContext } from "$fresh/src/server/types.ts";
|
||||
|
||||
export default async function App(req: Request, ctx: AppContext) {
|
||||
await delay(100);
|
||||
|
||||
return (
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charSet="utf-8" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0"
|
||||
/>
|
||||
<title>fresh title</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="app">
|
||||
App template
|
||||
<ctx.Component />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { LayoutContext } from "$fresh/server.ts";
|
||||
import { delay } from "$std/async/delay.ts";
|
||||
|
||||
export default async function AsyncLayout(
|
||||
req: Request,
|
||||
ctx: LayoutContext,
|
||||
) {
|
||||
await delay(10);
|
||||
return (
|
||||
<div class="layout">
|
||||
<p>Async layout</p>
|
||||
<ctx.Component />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// deno-lint-ignore require-await
|
||||
export default async function Home() {
|
||||
return (
|
||||
<div class="page">
|
||||
Home
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user