Skip to content
gtsafas edited this page Jun 23, 2011 · 3 revisions

Using CouchDB in Mojolicious

brief stub needs fixing (push norbu09 to do it!)

code looks something like this:

my $couch = 'http://127.0.0.1:4984/couch_test/';

get '/user' => sub {
    my $self = shift;

    my $url = $couch.'_design/overview/_view/users?include_docs=true&key="'.$self->session->{'name'}.'"';
    my $view = $client->get($url)->success->json->{rows}->[0]->{doc};
    delete $view->{password};
    $self->stash->{profile} = $view;
} => 'user';

demo app

Demo app is on github http://github.com/norbu09/

Clone this wiki locally