Skip to content

Instantly share code, notes, and snippets.

@le0pard
Created March 8, 2012 19:20
Show Gist options
  • Save le0pard/2002829 to your computer and use it in GitHub Desktop.
Save le0pard/2002829 to your computer and use it in GitHub Desktop.
app.js generated content
 var couchapp = require('couchapp')
, path = require('path')
;
ddoc =
{ _id:'_design/app'
, 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