From ded0867b9e14f848f980da7e6d634ef99d22f19c Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Thu, 22 Feb 2024 15:47:59 -0500 Subject: [PATCH] Forgot controllers. --- controllers/todo.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 controllers/todo.js diff --git a/controllers/todo.js b/controllers/todo.js new file mode 100644 index 0000000..104b489 --- /dev/null +++ b/controllers/todo.js @@ -0,0 +1,16 @@ +import { ToDo } from "../lib/models.js"; +import nunjucks from "nunjucks"; + +export class Todo { + constructor() { + } + + async get(req, rep) { + const todo_list = await ToDo.all({}); + + const result = nunjucks.render("todo.html", + {todo_list, name: "Zed"}); + + rep.code(200).type("text/html").send(result); + } +}