Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
MomsTattoo app.js for CouchApp
 var couchapp = require('couchapp')
, path = require('path')
;
ddoc =
{ _id:'_design/MomsTattoos'
, rewrites :
[ {from:"/", to:'index.html'}
, {from:"/api", to:'../../'}
, {from:"/api/*", to:'../../*'}
, {from:"/*", to:'*'}
]
}
;
ddoc.views = {};
ddoc.validate_doc_update = function (newDoc, oldDoc, userCtx) {
if (newDoc._deleted === true && userCtx.roles.indexOf('_admin') === -1) {
throw "Only admin can delete documents on this database.";
}
}
couchapp.loadAttachments(ddoc, path.join(__dirname, 'attachments'));
module.exports = ddoc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment