vm: Serve todo-app from www directory

This commit is contained in:
Alexander Kobjolke 2024-01-14 21:43:05 +01:00
parent a7f07853ee
commit dbbc8c63b8
2 changed files with 24 additions and 7 deletions

View file

@ -6,13 +6,7 @@
virtualHosts.localhost.locations."/" = { virtualHosts.localhost.locations."/" = {
index = "index.html"; index = "index.html";
root = pkgs.writeTextDir "index.html" '' root = ./www;
<html>
<body>
Hello World!
</body>
</html>
'';
}; };
}; };
}; };

23
www/index.html Normal file
View file

@ -0,0 +1,23 @@
<html>
<body>
<button id='add'>+</button>
</body>
<script>
let add = document.getElementById('add');
function newTask() {
let subtract = document.createElement('button');
subtract.textContent = "-";
let input = document.createElement('input');
input.setAttribute('type', 'text');
let div = document.createElement('div');
div.replaceChildren(subtract, input);
function remove() {
div.replaceChildren();
div.remove();
}
subtract.addEventListener('click', remove);
add.before(div);
}
add.addEventListener('click', newTask);
</script>
</html>