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

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.

主站蜘蛛池模板: 古丈县| 辉县市| 灵宝市| 嘉定区| 穆棱市| 永新县| 美姑县| 新巴尔虎左旗| 云霄县| 青田县| 洱源县| 任丘市| 洪洞县| 夹江县| 朝阳县| 诏安县| 奉新县| 蓬安县| 麻江县| 乌拉特后旗| 合阳县| 宜良县| 枣庄市| 安仁县| 苍梧县| 仁寿县| 安泽县| 哈尔滨市| 郯城县| 平邑县| 定州市| 宽甸| 乌兰县| 广元市| 聊城市| 海淀区| 锦州市| 河津市| 蒙自县| 龙州县| 丽水市|