Skip to content

Instantly share code, notes, and snippets.

@andreastt
Created October 18, 2011 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreastt/1296202 to your computer and use it in GitHub Desktop.
Save andreastt/1296202 to your computer and use it in GitHub Desktop.
package Kultur;
use Mojo::Base 'Mojolicious';
use Mojolicious::Plugin::Database;
sub startup {
my $app = shift;
# Config
my $config = $app->plugin('JSONConfig' => {
file => 'config/kultur.development.json',
stash_key => 'config'
});
# Database
$app->plugin('database', {
dsn => 'dbi:Pg:dbname=' . $config->{db}{name},
username => $config->{db}{user},
password => $config->{db}{pass},
options => { 'pg_enable_utf8' => 1, AutoCommit => 0 },
helper => 'db'
});
# Routes
my $r = $app->routes;
$r->route('/sources')->to('sources#index');
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment