sbhu6q
Last Updated: February 25, 2016
·
1.352K
· steveniseki
Stevenm

getting started with node express on mac osx mavericks

I just got a new macbook with OSX Mavericks. So just wanted to write a quickstart guide for setting up node and express. Here is the official and best express guide

<b>Install node.js and npm</b>

First step install node.js which comes with npm

<b>Set your user account as owner of /usr/local</b>

First so you will be okay installing node packages in your usr/local directory

sudo chown -R $USER /usr/local

This command sets your user account as the owner of the /usr/local directory. Now you won’t have to use sudo when you issue npm commands

<b>Set up Express</b>

Lets install Express to get a simple app up and running

http://expressjs.com/guide.html

The Express team maintains a quickstart project generator, express(1). Install express-generator globally with npm

npm install -g express-generator

Let the generator set up your first express app

express --css stylus myapp

Jump into your apps directory, then like any other node application, you must install the dependencies. These have been defined in the apps package.json file. npm install will bring them into your apps node modules folder.

cd myapp
npm install

Now fire up your app

npm start

Jump into the browser and navigate to localhost to view your app. Should be http://localhost:3000/. Now start playing around and building some node apps.

Say Thanks
Respond