yuki-kimoto/Mojolicious-Plugin-DBViewer — pull request #2 by Akron (2013-04-05 16:46:57+00:00)
Title: Shortcut route

Hi!
Here's a proposal for a simpler endpoint routing. In your synopsis you show how to change the default route to the dbviewer:

```perl
# Prefix change (http://localhost:3000/dbviewer2)
plugin 'DBViewer', dbh => $dbh, prefix => 'dbviewer2';

# Route
my $bridge = $app->route->under(sub {...});
plugin 'DBViewer', route => $bridge, ...;
```

I would argue that this solution is not optimal as it proposes two solutions to the same problem - one simple but not flexible, one complicated but flexible.
The default route is also problematic, as this route would be triggered whenever there is a known security issue with this plugin.

My pull request introduces a "dbviewer" shortcut, which should be very easy to adopt (for compatibility reasons I did not delete the prefix configuration option, although I think it shouldn't stay if my approach is adopted).

In that case, a user could simply define the route by using '->dbviewer':

```perl
plugin 'DBViewer', dbh => $dbh;
(any '/mydbviewer')->dbviewer;
```

The shortcut works well with bridges, so an authorization path works the same way as a normal path. You could even add different shortcuts with different functionalities, for example:

```perl
plugin 'DBViewer';
(any '/mysqlitedbviewer')->dbviewer(dbh => $dbh);
(any '/mymysqldbviewer')->dbviewer(dbh => $dbh2);
```

With best regards,
Akron