Created
April 24, 2012 00:08
-
-
Save DaveWelling/2474829 to your computer and use it in GitHub Desktop.
MomsTattoo app.js for CouchApp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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