Sascha Schulz
2023-04-05 616baa176c724735fadea8b15729145c16926613
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module.exports = function(todos) {
    return `
        <!DOCTYPE html>
        <html lang="de">
            <head>
                <meta charset="UTF-8">
                <title>todo</title>
            </head>
            <body>
                <form method="post" action="/todo">
                    <input name="todo"><button>add</button>
                </form>
                <div id="list">
                    ${todos
                        .map((todo) => `
                            <div class="todo">
                                <span>${todo}</span>
                                <form action="/todo/delete" method="post">
                                    <input type="hidden" name="todo" value="${todo}">
                                    <button>X</button>
                                </form>
                            </div>`)
                        .join("")}
                </div>
            </body>
        </html>
    `;
}