Skip to content

Instantly share code, notes, and snippets.

View toddbluhm's full-sized avatar
☃️

Todd Bluhm toddbluhm

☃️
View GitHub Profile
var BB = require('bluebird');
var request = BB.promisifyAll(require('request'));
var ziptoo = require('funkit').functional.ziptoo;
var resourcesToKey = {
'checks' : function(obj){
return obj.checks || obj.check;
},
'analysis' : function(obj) {
return obj.analysis || obj;
@toddbluhm
toddbluhm / app.js
Created July 11, 2013 06:09
This is a modified version of the Cloudant reverse-proxy solution for setting up a CORS Couchdb request. The version uses the nano framework instead of request framework which allows for the use of cookie authentication rather than just hardcoded basic auth. This solution was tested using Pouchdb in the browser, reverse-proxied back through a no…
var forward = require('./middleware/forward.js'); //reverse proxy
var nano = require('connect-nano');
// instantiate `app` et al
//After app.use(express.cookieParser());
app.use(nano('https://username.cloudant.com')),
app.use(forward(/\/db\/(.*)/));