An even more educational version of the Bandolier for Learn JS the Hard Way.
https://learnjsthehardway.com/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
456 B
20 lines
456 B
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);
|
|
}
|
|
}
|
|
|
|
// you use the export default to set the route URL?
|
|
// I mean, it works not sure if I like it though
|
|
export default { todo: Todo };
|
|
|