Created
October 18, 2011 18:15
-
-
Save andreastt/1296202 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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