/s/<url> route to get shorten url from console
This commit is contained in:
parent
6d3d1aa9a3
commit
0be901efd8
1 changed files with 7 additions and 0 deletions
|
@ -18,6 +18,13 @@ get '/' => sub ($c) {
|
||||||
$c->render(template => 'index', page_data => {});
|
$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) {
|
post '/' => sub ($c) {
|
||||||
my $url = normalize_source_url($c->param('url'));
|
my $url = normalize_source_url($c->param('url'));
|
||||||
my $shorten_path = write_url($url);
|
my $shorten_path = write_url($url);
|
||||||
|
|
Loading…
Reference in a new issue