Files
archived-YouRL/Views/index.ejs
Sunny Dhoke a2acc098a7 Added timestamp feature
`.createdAt`;
gives the moment the link was submitted
2020-10-09 17:00:35 +05:30

59 lines
1.7 KiB
Plaintext

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z"
crossorigin="anonymous"
/>
<title>YouRL-Hello Universe</title>
</head>
<body>
<div class="container">
<h1>URL Shortner</h1>
<form action="shortUrls" method="POST" class="my-4 form-inline">
<label for="fullUrl" class="sr-only">URL</label>
<input
required
placeholder="Enter URL"
type="url"
name="fullUrl"
id="fullUrl"
class="form-control mr-1 col"
/>
<button type="submit" class="btn btn-success">Shorten my link!</button>
</form>
<table class="table table-boderless table-responsive">
<caption>
List of URLs and click counts
</caption>
<thead>
<tr>
<th>Full URL</th>
<th>Shortened URL</th>
<th>Total Clicks</th>
<th>Timestamp</th>
</tr>
</thead>
<tbody>
<% shortUrls.forEach(shortUrl => { %>
<tr>
<td>
<a href="<%= shortUrl.full %>"><%= shortUrl.full %></a>
</td>
<td><a href="<%= shortUrl.short %>"><%= shortUrl.short %> </a></td>
<td><%= shortUrl.clicks %></td>
<td><%= shortUrl.createdAt;%></td>
</tr>
<% }) %>
</tbody>
</table>
</div>
</body>
</html>