Mongodb
Installation section:
Visit MongoDB Download MongoDB (2.6.0) Here we download Mac OS X 64-bit
1. The download should be tgz package such as Mongodb-osx-x86_64-2.6.0.tgz
2. Perform the decompression command on the terminal TAR-ZXVF mongodb-osx-x86_64-2.6.0.tgz
3. After decompression we can put in our own directory (optional)
4. Add the environment variable path:
Terminal input echo $PATH to view the current PATH
Add PATH command: echo "Export path=xxxxxx: $PATH" >> ~/.bash_profile
Here xxx for decompression after the path of the bin subdirectory in the MongoDB folder such as:
Echo ' Export path=/users/dalong/documents/mongodb/bin: $PATH ' >>~/.bash_profile
After setting up, open the new terminal and view path.
Run part:
1. Set the database file path
Terminal input mkdir-p/data/db Create directory
/DATA/DB is the default path be sure to ensure that the current user has read and write access to the directory.
2. Set permissions: Set permissions in the right-click Sharing and permissions on the folder (note unlock and enter the password)
Add the current user and select Read and Write permissions.
3. Terminal input Mongod running MongoDB.
If the database path is modified in the first step, the terminal input: Mongod--dbpath path (e.g. Mongod--dbpath/users/dalong/data/db/)
NODE. Js
Access http://nodejs.org/latest version of node. JS PKG Package
Direct default installation will prompt
Node is installed at "/usr/local/bin/node"
NPM is installed at "/USR/LOCAL/BIN/NPM"
Make sure That/usr/local/bin are in your $PATH.
Create example.js under/usr/local/bin/node path if unable to create please set permissions above reference
Code:
var http=Require(' HTTP '); HTTP.Createserver(function(reqRes){Res.Writehead(200{ ' content-type ' : Text/plain ' }end ( ' Hello World \n ' } listen (1337 127.0.0.1 ' . Log ( ' Server running at http://127.0.0.1:1337/'
Save and enter node Example.js in terminal normally displays the Server running at http://127.0.0.1:1337/
Open the browser input address http://127.0.0.1:1337/to view.
Mac Install MongoDB