grunt-couchapp/demo/app.js

23 lines
480 B
JavaScript
Raw Normal View History

2012-08-10 01:34:00 +00:00
var couchapp, ddoc, path;
couchapp = require('couchapp');
path = require('path');
ddoc = {
_id: '_design/app',
rewrites: {},
views: {},
shows: {},
lists: {},
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;