Skip to content

Instantly share code, notes, and snippets.

@DaveWelling
Created April 24, 2012 00:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DaveWelling/2474829 to your computer and use it in GitHub Desktop.
Save DaveWelling/2474829 to your computer and use it in GitHub Desktop.
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