vm: Serve todo-app from www directory
This commit is contained in:
parent
a7f07853ee
commit
dbbc8c63b8
2 changed files with 24 additions and 7 deletions
|
|
@ -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
23
www/index.html
Normal 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>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue