Replies: 3 comments 2 replies
-
Otherwise it seems better to handle validations and document type constraints in your application logic. |
Beta Was this translation helpful? Give feedback.
-
That's true, there is nothing in CouchDB to make calls to other services in a updater handler or validate_doc_update function. It seems your application layer should do the validation, run action before the updates, do the doc update, then possibly run actions after the update. |
Beta Was this translation helpful? Give feedback.
-
If the body of the requests have nothing in them, what you base your constraints / validation on? Otherwise, it seems you need to make external calls before the documents are written (not sure if I misunderstood that point?), so you'd build an API to handle your updates in your middleware, validate there, possibly calling pre-update handlers, then write the document to the database, then maybe run some post-update handlers. If there is just a simple accept / reject logic, and you don't want to run a middleware layer, can use |
Beta Was this translation helpful? Give feedback.
-
Hi all,
hoping for some direction. I may be missing some fundamental understanding.
I want to 'verify' and do 'actions' depending on the couchdb requests (such as insert/update etc)
AFAIK, this is currently all done on the frontend (ie not secure).
Adding members to “_design”, such as “validate_doc_update”, is really suitable as it may need to make external calls etc.
I proxied the couchdb URL, but could not find anything meaningful in the body if the requests.
Is it possible to have a "middleware" layer (server) which allows/denies requests?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions