forked from mojolicious/mojo
-
Notifications
You must be signed in to change notification settings - Fork 0
Using couchdb
gtsafas edited this page Jun 23, 2011
·
3 revisions
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 is on github http://github.com/norbu09/