官术网_书友最值得收藏!

Time for action — getting a list of all databases in CouchDB

You've seen a GET request earlier in this book when we used the curl statement: curl http://localhost:5984.

This time, let's issue a GET request to access CouchDB and get a list of all of the databases on the server.

  1. Run the following command in Terminal:
    curl -X GET http://localhost:5984/_all_dbs 
    
  2. Terminal will respond with the following:
    ["_users"] 
    

What just happened?

We used Terminal to trigger a GET request to CouchDB's RESTful JSON API. We used one of the options: -X, of curl, to define the HTTP method. In this instance, we used GET. GET is the default method, so technically you could omit -X if you wanted to. Once CouchDB processes the request, it sends back a list of the databases that are in the CouchDB server. Currently, there is only the _users database, which is a default database that CouchDB uses to authenticate users.

主站蜘蛛池模板: 疏勒县| 琼结县| 兰西县| 邢台市| 南丰县| 新巴尔虎左旗| 故城县| 县级市| 那曲县| 凤台县| 雅安市| 凌源市| 怀仁县| 娱乐| 天峻县| 沁阳市| 平度市| 旌德县| 临猗县| 庐江县| 青河县| 凤翔县| 香格里拉县| 金华市| 获嘉县| 唐海县| 施秉县| 和田市| 金塔县| 扎赉特旗| 小金县| 正宁县| 环江| 江达县| 故城县| 乾安县| 民乐县| 伊金霍洛旗| 沁源县| 高淳县| 商丘市|