No Batteries Required - Home
Node to Self: Get Ready for Asynchronous Programming - Part II
Ray Kahn
APR 30, 2015 10:53 AM
A+ A A-

In this section I will discuss installing and configuring Node.js & NPM (Node Package Manager).

Installing Python

If you intend to install and build Node.js from the source tarball you will need to install Python on your Mac. Download the installer from here: https://www.python.org/downloads/mac-osx/

Installing Node.js & NPM

Node provides a installer for all the popular operating systems. As I mentioned in my previous blog all of my instructions should work on an OSX Yosemite Mac. The link for pre-build installer can be found here: https://nodejs.org/download. Follow the instructions and by the end of installation process you will installed Node and NPM in "/usr/local/bin" directory. You are done and ready to use Node.

NPM will allow you to install different but necessary Node packages quickly and easily on your computer. 

BTW, you will need to install Python (or at least make sure that it is already installed on your Mac) if you would like to install Node & NPM using the source code. If your Mac is missing Python please see "Installing Python" section. 

Setting up Your Ecosystem for Node.js

On my computer I have created “adminui” directory under “/Users/raykahn”. This is the project where I will be using Node and other packages to build my custom publishing platform.

The contents of the directory are:

-- Img 

-- certs

-- config.js (global configuration file)

-- controllers 

-- data

-- devkeys

-- entities (my mongoDB document definitions)

-- haproxy.cfg (haproxy configuration file)

-- models 

-- node_modules (all node modules are installed here using npm install $package_name)

-- passbook

-- qrcode

-- routes (This is where I have defined all my RESTfull APIs in a file named index.js) 

-- server.js (Node.js server configuration file)

-- tmp

-- util

-- views

Note that you may not need all the directories which I have created. I follow the MVC architectural pattern and I highly recommend that you follow either MVC or some other pattern that you know or are comfortable with.

What Next

Next week I will go through installing mongoDB, a noSQL database server.

FIRST
PREV
NEXT
LAST
Page(s):
[%= name %]
[%= createDate %]
[%= comment %]
Share this:
Please login to enter a comment:
 
RESET