CouchDB proxy for _design _view
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 15 Nov 2010 16:17:40 +0000 (17:17 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 15 Nov 2010 16:17:40 +0000 (17:17 +0100)
angular-server.pl
public/app/conference/symposiums.js

index 9450517..0d1622e 100755 (executable)
@@ -171,6 +171,15 @@ get '/app/:database/angular.js' => sub {
        $self->render_static( $ANGULAR_JS );
 };
 
+# CouchDB proxy for _design _view
+
+get '/:database/_design/:design/_view/:view' => sub {
+       my $self = shift;
+       my $url = $self->param('url');
+       warn "# /couchdb $url";
+       _render_jsonp( $self, _couchdb_get( $self->param('database') . '/_design/' . $self->param('design') . '/_view/' . $self->param('view') ) );
+};
+
 app->start;
 __DATA__
 
index 7502e76..3713664 100644 (file)
@@ -10,7 +10,7 @@ function Symposiums(xhr, route){
        this.data = data;
 
        this.xhr("JSON"
-               , "http://localhost:5984/conference/_design/symposium/_view/work_nr%2Ctitle?callback=JSON_CALLBACK"
+               , "/conference/_design/symposium/_view/work_nr%2Ctitle?callback=JSON_CALLBACK"
                , function(code, response){ 
                        console.log(code, response, data);
                        data.response = response;