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

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.

主站蜘蛛池模板: 明溪县| 奇台县| 富宁县| 安徽省| 丰城市| 阿荣旗| 北宁市| 榕江县| 东明县| 五台县| 新营市| 塔城市| 嘉定区| 库车县| 丰都县| 阿图什市| 镇康县| 肥城市| 班玛县| 繁昌县| 乳山市| 金阳县| 牡丹江市| 应用必备| 新安县| 邵阳市| 马公市| 阿拉善左旗| 华亭县| 正定县| 鹿邑县| 壤塘县| 都匀市| 色达县| 延津县| 阜新市| 塘沽区| 精河县| 中山市| 宜阳县| 上虞市|