Created
March 1, 2022 15:06
-
-
Save RanjanSushant/308973f487779c59cd05118d97d0f46b to your computer and use it in GitHub Desktop.
Application for Codesphere Docker demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Docker Demo</title> | |
</head> | |
<body> | |
<h1>To Do List</h1> | |
<br /> | |
<input id="todo-input" type="text" placeholder="Your todo here..." /> | |
<br /> | |
<br /> | |
<button id="add-btn">Add todo</button> | |
<br /> | |
<ul id="todo-list"></ul> | |
<script type="text/javascript" src="./script.js"></script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const todoInput = document.getElementById("todo-input"); | |
const addBtn = document.getElementById("add-btn"); | |
const todoList = document.getElementById("todo-list"); | |
addBtn.addEventListener("click", function (e) { | |
e.preventDefault(); | |
const listItem = document.createElement("li"); | |
listItem.textContent = todoInput.value; | |
todoList.prepend(listItem); | |
todoInput.value = ""; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const path = require("path"); | |
const app = express(); | |
app.use(express.static(__dirname)); | |
app.get(__dirname, function (req, res) { | |
res.sendFile(path.join(__dirname, "index.html")); | |
}); | |
app.listen(3000, function () { | |
console.log("Listening on port 3000!"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment