Skip to content

Instantly share code, notes, and snippets.

@tjkhara
Created November 8, 2020 05:06
Show Gist options
  • Select an option

  • Save tjkhara/625d3be2e03b664b6e73b10779fa3668 to your computer and use it in GitHub Desktop.

Select an option

Save tjkhara/625d3be2e03b664b6e73b10779fa3668 to your computer and use it in GitHub Desktop.
Simple html template with express
let express = require('express')
let app = express()
app.get('/', function(req, res){
res.send(`
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple To-Do App</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
</head>
<body>
<div class="container">
<h1 class="display-4 text-center py-1">To-Do App</h1>
<div class="jumbotron p-3 shadow-sm">
<form>
<div class="d-flex align-items-center">
<input autofocus autocomplete="off" class="form-control mr-3" type="text" style="flex: 1;">
<button class="btn btn-primary">Add New Item</button>
</div>
</form>
</div>
<ul class="list-group pb-5">
<li class="list-group-item list-group-item-action d-flex align-items-center justify-content-between">
<span class="item-text">Fake example item #1</span>
<div>
<button class="edit-me btn btn-secondary btn-sm mr-1">Edit</button>
<button class="delete-me btn btn-danger btn-sm">Delete</button>
</div>
</li>
<li class="list-group-item list-group-item-action d-flex align-items-center justify-content-between">
<span class="item-text">Fake example item #2</span>
<div>
<button class="edit-me btn btn-secondary btn-sm mr-1">Edit</button>
<button class="delete-me btn btn-danger btn-sm">Delete</button>
</div>
</li>
<li class="list-group-item list-group-item-action d-flex align-items-center justify-content-between">
<span class="item-text">Fake example item #3</span>
<div>
<button class="edit-me btn btn-secondary btn-sm mr-1">Edit</button>
<button class="delete-me btn btn-danger btn-sm">Delete</button>
</div>
</li>
</ul>
</div>
</body>
</html>
`)
})
app.listen(3001)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment