Chapter 3. Getting Started
In this chapter, we’ll take a quick tour of CouchDB’s features, familiarizing ourselves with Futon, the built-in administration interface. We’ll create our first document and experiment with CouchDB views. Before we start, skip to Appendix D and look for your operating system. You will need to follow those instructions and get CouchDB installed before you can progress.
All Systems Are Go!
We’ll have a very quick look at CouchDB’s bare-bones
Application Programming Interface (API) by using the
command-line utility curl. Please note that this is
only one way of talking to CouchDB. We will show you plenty more
throughout the rest of the book. What’s interesting about
curl is that it gives you control over raw HTTP
requests, and you can see exactly what is going on “underneath the hood”
of your database.
Make sure CouchDB is still running, and then do:
curl http://127.0.0.1:5984/
This issues a GET request to your newly installed
CouchDB instance.
The reply should look something like:
{"couchdb":"Welcome","version":"0.10.1"}
Not all that spectacular. CouchDB is saying “hello” with the running version number.
Next, we can get a list of databases:
curl -X GET http://127.0.0.1:5984/_all_dbs
All we added to the previous request is the
_all_dbs string.
The response should look like:
[]
Oh, that’s right, we didn’t create any databases yet! All we see is an empty list.
Note
The curl command issues GET
requests by default. You can issue POST requests
using curl -X POST. To make it ...