Skip to content

Instantly share code, notes, and snippets.

@RanjanSushant
Created March 1, 2022 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RanjanSushant/308973f487779c59cd05118d97d0f46b to your computer and use it in GitHub Desktop.
Save RanjanSushant/308973f487779c59cd05118d97d0f46b to your computer and use it in GitHub Desktop.
Application for Codesphere Docker demo
<!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>
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 = "";
});
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