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

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.

主站蜘蛛池模板: 措美县| 泸定县| 上栗县| 南阳市| 松江区| 疏勒县| 资阳市| 青田县| 南平市| 太原市| 岳阳市| 公主岭市| 兴义市| 西峡县| 朝阳市| 定结县| 嘉义县| 沭阳县| 布拖县| 灵台县| 南投市| 海门市| 安阳县| 新野县| 平顶山市| 武强县| 淮南市| 运城市| 尤溪县| 丹江口市| 湖南省| 茌平县| 寻甸| 商洛市| 长宁县| 苍溪县| 綦江县| 安仁县| 上饶县| 东丰县| 栾城县|