Quick start
Follow these instructions to download and install the tutorial application.
This quick start will help you to set up the code and just follow along as you read through the rest of the tutorial.
-
Download Couchbase Server and install it. Make sure to install the beer-sample bucket when you run the wizard because this tutorial application works with it.
-
Clone the repository and install dependencies (Express and Jade):
$ git clone git://github.com/couchbaselabs/beersample-node Cloning into 'beersample-node' #... $ cd beersample-node $ npm install -
Set up the views.
You can set up the views manually by using the Couchbase Server administration console or by invoking the beer.js script located in the beersample-node directory.
To set up the views with the script, enter the following command:
$ node beer.js --setup
To set up the views manually, open the Couchbase Server administration console. In the
beerdesign document, create a development view calledby_name, then promote it to a production view. (The beer-sample bucket might already have a production design document named beer with a by_name view. If it does, you can skip this step.) Here’s the JavaScript map function for the view:function (doc, meta) { if (doc.type && doc.type == "beer") { emit(doc.name, null); } }Create another design document called
brewery, add a view calledby_name, and publish it to a production view. Here’s the JavaScript map function for the view:function (doc, meta) { if (doc.type && doc.type == "brewery") { emit(doc.name, null); } } -
Invoke the beer.js script:
$ node beer.js Server running at http://127.0.0.1:1337/ -
In your web browser, navigate to http://localhost:1337/welcome, and enjoy the application!