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

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.

主站蜘蛛池模板: 太保市| 壤塘县| 光泽县| 新巴尔虎左旗| 南丹县| 斗六市| 金昌市| 纳雍县| 巫山县| 沅陵县| 金乡县| 韩城市| 娱乐| 张家口市| 赣榆县| 河北区| 鸡西市| 华坪县| 浦东新区| 双辽市| 额尔古纳市| 临安市| 高唐县| 武川县| 永善县| 福清市| 阿克苏市| 乐至县| 屏山县| 垦利县| 葫芦岛市| 康定县| 平昌县| 恩施市| 高州市| 甘洛县| 高碑店市| 望奎县| 威远县| 鲁甸县| 德保县|