/s/<url> route to get shorten url from console

This commit is contained in:
Denis Fedoseev 2019-02-13 13:13:32 +03:00
parent 6d3d1aa9a3
commit 0be901efd8

View file

@ -18,6 +18,13 @@ get '/' => sub ($c) {
$c->render(template => 'index', page_data => {});
};
get '/s/*url' => sub ($c) {
my $url = normalize_source_url($c->param('url'));
my $shorten_path = write_url($url);
my $shorten_url = $SITE_NAME.$shorten_path;
$c->render(text => $shorten_url);
};
post '/' => sub ($c) {
my $url = normalize_source_url($c->param('url'));
my $shorten_path = write_url($url);