问题描述
我一直在寻找示例或只是直接回答我的问题。是否可以为沙发数据库创建/扩展我自己的自定义api端点?例如,例如,我可以创建一个 ...用数据填充数据库?
如果ouchDB确实提供了此功能,那么请向我提供一些教程的链接/ guide / example(如果可能)。谢谢。
您也许想要,该功能允许任何视图重写传入的该数据库的URL 。
但是,对于根级API并为了易于定制,最好使用Web引擎在CouchDB(nginx,node.js服务器等)的前面。 _rewrites
足够灵活,可以简化特定数据库的API,但并非旨在处理所有传入请求,并且很快就会变得笨拙。
您还将仅限于CouchDB可以处理的工作-例如, FillDatabase
自定义API需要符合批量API。 / p>
I have been googling around trying to find examples or just a straight answer to my question. Is it possible to create/extend my own custom api endpoints for couchDB? Such as for example can I create a api call like http://127.0.0.1:5984/database/FillDatabase/... to fill the database with data?
If couchDB does indeed provide this functionality, then please provide me with a link perhaps to some tutorial/guide/example if possible. Thanks.
You may want the _rewrites
feature, which allows any view to rewrite an incoming URL for that database.
However, for root-level APIs, and for ease of customization, it is considered better to impose a web engine in front of CouchDB (nginx, a node.js server, etc.). _rewrites
is flexible enough to simplify the API for a specific db, but it's not intended to handle all incoming requests, and can quickly become unwieldy.
You would also be limited to the work that CouchDB can handle - for example, the FillDatabase
custom API would need to conform to the bulk API.
这篇关于CouchDB的自定义Rest API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!