CouchDB的自定义Rest API?

编程入门 行业动态 更新时间:2024-10-14 18:20:00
本文介绍了CouchDB的自定义Rest API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我一直在寻找示例或只是直接回答我的问题。是否可以为沙发数据库创建/扩展我自己的自定义api端点?例如,例如,我可以创建一个 127.0.0.1:5984/database/ FillDatabase / ...用数据填充数据库?

如果ouchDB确实提供了此功能,那么请向我提供一些教程的链接/ guide / example(如果可能)。谢谢。

解决方案

您也许想要 _rewrites 功能,该功能允许任何视图重写传入的该数据库的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 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?

本文发布于:2023-11-28 16:06:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643067.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   CouchDB   API   Rest

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!