This article mainly introduces how to use Node in MacOS. simple js tutorial, Node. js is a framework that allows JavaScript applications to run on the server. if you need JavaScript, you can refer to this article for a good Node. js introduction article great nodejs intro, which will give you a very convenient introduction to Node. js and CouchDB, and provide an instance to implement the REST service for performing the CRUD operation on bookmarks, using CouchDB as the database.
This article describes how to install and start using Node in Mac OS X. js. this process takes about 30 minutes. we will also install CouchDB and implement CouchDB-based REST APIs.
This document assumes that Git has been installed on your machine. if not, please refer to this article for installation.
Install node. js and npm
The simplest method is in node. on the official js website, go to the nodejs download section page and select the installation program under Mac. it will install Node on your machine. js and npm (node package manager ).
After the installation is successful, you can use the node and npm commands.
Install CouchDB
Because this article uses CouchDB to store objects, you also need to install CouchDB.
Installing CouchDB is a little troublesome, because we need to download the source code and then compile I. Before that, we need to install Homebrew. please execute the following command:
git clone https://github.com/mxcl/homebrew.gitcd homebrew/binbrew install autoconf automake libtoolbrew install couchdb
Note: a problem reported before CouchDB may prevent installation. to fix this problem, you must manually edit it ~ The/couch/homebrew/Library/Formula/couchdb. rb file is edited as follows:
The code is as follows:
Require 'formula'
Class Couchdb <Formula
Url 'http: // www.apache.org/dyn/closer.cgi? Path = couchdb/source/1.1.1/apache-couchdb-1.1.1.tar.gz'
Homepage "http://couchdb.apache.org /"
Md5 'cd126219b9cb69a4c521abd6960807a6'
Note that you need to delete the source in the url. The final modification result is as follows:
The code is as follows:
Require 'formula'
Class Couchdb <Formula
Url 'http: // www.apache.org/dyn/closer.cgi? Path = couchdb/1.1.1/apache-couchdb-1.1.1.tar.gz'
Homepage "http://couchdb.apache.org /"
Md5 'cd126219b9cb69a4c521abd6960807a6'
If the installation process is suspended, you need to terminate the CTRL-C and execute the following command to try again:
The code is as follows:
./Brew install-v couchdb