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

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.

主站蜘蛛池模板: 黄浦区| 阜宁县| 德化县| 报价| 临邑县| 南木林县| 五河县| 宁化县| 丹阳市| 阜宁县| 河西区| 土默特左旗| 苍山县| 资溪县| 吉安县| 嵩明县| 南投县| 西充县| 义马市| 江山市| 东乡| 凤山县| 临清市| 天气| 石首市| 如皋市| 庄浪县| 广元市| 东海县| 宁明县| 河南省| 铜梁县| 宝应县| 博罗县| 巴里| 凌源市| 教育| 普宁市| 读书| 津南区| 白山市|