Summary: T2316 Test Plan: Wykonać komendę arc lint, powinno wyświetlić okey Reviewers: #testers, kuba-orlik Reviewed By: #testers, kuba-orlik Subscribers: jenkins-user Maniphest Tasks: T2316 Differential Revision: https://hub.sealcode.org/D1150
24 lines
565 B
TypeScript
24 lines
565 B
TypeScript
import Router from "@koa/router";
|
|
import { Context, Middlewares } from "sealious";
|
|
import html from "../html";
|
|
import { NewTask, TaskList } from "../views/tasks";
|
|
|
|
const router = new Router();
|
|
|
|
export async function MainView(context: Context): Promise<string> {
|
|
return await html(
|
|
context,
|
|
/* HTML */ `<title>My ToDo App</title>
|
|
<body>
|
|
<h1>My ToDo App</h1>
|
|
${await TaskList(context)} ${NewTask()}
|
|
</body>`
|
|
);
|
|
}
|
|
|
|
router.get("/", Middlewares.extractContext(), async (ctx) => {
|
|
ctx.body = await MainView(ctx.$context);
|
|
});
|
|
|
|
export default router;
|