Add / template
This commit is contained in:
@@ -3,6 +3,9 @@ import type { Call, Result, Route } from "../types";
|
|||||||
import { html, render } from "../util";
|
import { html, render } from "../util";
|
||||||
import { loginRoute } from "./login";
|
import { loginRoute } from "./login";
|
||||||
|
|
||||||
|
import { services } from '../services';
|
||||||
|
|
||||||
|
|
||||||
const routes: Record<string, Route> = {
|
const routes: Record<string, Route> = {
|
||||||
hello: {
|
hello: {
|
||||||
path: "/hello",
|
path: "/hello",
|
||||||
@@ -18,7 +21,11 @@ const routes: Record<string, Route> = {
|
|||||||
path:'/',
|
path:'/',
|
||||||
methods:['GET'],
|
methods:['GET'],
|
||||||
handler:async(_call:Call): Promise<Result> => {
|
handler:async(_call:Call): Promise<Result> => {
|
||||||
const c = await render('basic/home')
|
const auth = services.auth
|
||||||
|
const me = services.session.getUser()
|
||||||
|
|
||||||
|
const email = me.toString()
|
||||||
|
const c = await render('basic/home',{email})
|
||||||
|
|
||||||
return html(c)
|
return html(c)
|
||||||
}
|
}
|
||||||
|
|||||||
11
templates/basic/home.html.njk
Normal file
11
templates/basic/home.html.njk
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<html>
|
||||||
|
<head></head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
home
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{{ email }}
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user