Express_Crud_Example/views/index.ejs
2022-01-29 22:57:19 +01:00

57 lines
1.6 KiB
Plaintext

<!DOCTYPE html>
<html lang="en">
<head>
<link href="/css/style.css" rel="stylesheet" type="text/css">
<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>MY APP</title>
</head>
<body>
<h1>Express Node App</h1>
<form action="/quotes" method="post">
<input type="text" placeholder="name" name="name">
<input type="text" placeholder="quotes" name="quotes">
<button type="submit">Submit</button>
</form>
<h2>Quotes</h2>
<ul class="quotes">
<!-- Loop through quotes -->
<% for(var i=0; i < quotes.length; i++) {%>
<li class="quote">
<!-- Output name from the iterated quote object -->
<span>
<%= quotes[i].name %>
</span>:
<!-- Output quote from the iterated quote object -->
<span>
<%= quotes[i].quotes %>
</span>
</li>
<% } %>
</ul>
<div>
<h2>Darth Vadar invades!</h2>
<p>
Replace first Yoda's quote with a quote written by Darth Vadar
</p>
<button id="update-button">Replace Yoda's quote</button>
</div>
<div>
<h2>Remove Darth Vadar!</h2>
<p>
Delete one Darth Vadar's quote. Does nothing if there are no more Darth
Vadar's quote
</p>
<button id="delete-button">Delete Darth Vadar's quote</button>
</div>
<script src="/main.js"></script>
</body>
</html>