I wonder if there is a way to write some show, list or update functions in a design document as I can do for a view one in Fauxton (with its editor).
When I create a view in Fauxton, I simply click the "Add view..." button. Then, I fill the fields for the design document and view names, and I can write my JS Code directly in the editor. When I save, the design document is correctly generated with my view function correctly escaped.
When I want to write a list for example, I have to edit the design document and write my function, for example:
...
"lists": {
"my-list": "function(head,req) {\n send(\"Simple Test\");\n}"
},
...
But it's tricky to correctly insert \n or \" as the function has to be passed as a string. It's very easy to forget something writing a function in this way.
I can't find a "add list..." option somewhere in the interface, so I use to create a new view with the application editor, change the function signature, save the document and then edit it again to cut/paste the function in its correct place, but it's not a solution.
So, what could be a better way to write theses functions ? (even with an external editor and then upload the function ?) Is there a way to write the JS Code in a external editor (Atom for example) and then "generate" the correct espaced string value for this function to upload into couchdb via curl?
Consider using Photon https://github.com/ermouth/couch-photon, it has decent editor for JS functions in JSON docs.