<!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>URL Shortener</title>
    <!-- CSS only -->
     <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">

</head>
<body>
    <div class="container">
    <h1 class="text-center">URL Shortener</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 col mr-2">
        <button class="btn btn-success" type="submit">Shorten</button>
    </form>

    <table class="table table-striped table-responsive">
        <thead>
            <tr>
                <th>Full URL</th>
                <th>Short URL</th>
                <th>Used </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><a href="<%= shortUrl.used %>"><%=shortUrl.used %></a></td>
            </tr>
            
           <%  }) %>
        </tbody>
    </table>
    </div>
</body>
</html>