Some routes
This commit is contained in:
parent
d6e352faaa
commit
71ea81d18e
|
@ -14,4 +14,5 @@ A "useful" tool for turning hyperlinks into redirects in the name of shortening
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
1. Fix my `.emacs` to style stuff in a way that is not in fact insane
|
1. Process the form input
|
||||||
|
1. Make the return url gzip/base64'd
|
||||||
|
|
|
@ -14,3 +14,14 @@ my $router = Router.new(root => '/');
|
||||||
$router.get(-> $request, $response {
|
$router.get(-> $request, $response {
|
||||||
$response.html($templates.process: 'index');
|
$response.html($templates.process: 'index');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$router.post(-> $request, $response {
|
||||||
|
$response.html($templates.process: 'index');
|
||||||
|
});
|
||||||
|
|
||||||
|
# Try a wildcard to catch 'all' path
|
||||||
|
$router.get('/**', -> $request, $response {
|
||||||
|
my $url = $request.path.substr(1); # Omits the leading slash
|
||||||
|
|
||||||
|
$response.redirect($url);
|
||||||
|
});
|
||||||
|
|
|
@ -4,3 +4,4 @@
|
||||||
<title>[% title %]</title>
|
<title>[% title %]</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<h1>[% title %]</h1>
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
[% INCLUDE 'header'
|
[% INCLUDE 'header'
|
||||||
title = 'Test page' %]
|
title = 'Create new hyperlink' %]
|
||||||
<h1>Ayy...</h1>
|
[% IF hyperlink %]
|
||||||
<p>lmao</p>
|
<p>Your hyperlink is: <a href="[% hyperlink %]">[% hyperlink %]</a></p>
|
||||||
|
[% END %]
|
||||||
|
<form method="post">
|
||||||
|
<label for="hyperlink">Hyperlink</label>
|
||||||
|
<input id="hyperlink" name="hyperlink" type="text" minlength="4"
|
||||||
|
maxlength="2097152" required>
|
||||||
|
<button type="submit">Process</button>
|
||||||
|
</form>
|
||||||
[% INCLUDE 'footer' %]
|
[% INCLUDE 'footer' %]
|
||||||
|
|
Loading…
Reference in a new issue