I'm trying to create a CouchApp somewhat similar to couchperuser that will create a couch database for each user. My goal is not setup a separate node server as I am looking to achieve a "frontend-only/no-backend" design. My idea was to use a Show Function that could use the couch admin's username and password to create databases. The problem with this approach is that Show Functions are side effect-free, which means that I cannot use a XMLHttpRequest object or modify a couch doc from within a Show Function. Is there another method available that uses a Show Function, Update Handler or some other CouchDB construct?
No. That is impossible.
The only way is to make the XHR request from the browser, after the page is served through the _show
function. If that suits your needs, then good; if not, then pure CouchApps aren't enough for you and you need a separate backend server.