Node.JS is javascript running outside of your browser allowing you to access your machine/etc.
Express framework can be used build web site.
Command | Description |
---|---|
node -v | Display version |
node | Run Node interpreter |
node <file> | Run javascript file |
Special Node.JS Javascript functions/objects
Command | Description |
---|---|
process | Show program process |
var m2 = require('./module2'); | Loads file module2 in current directory |
console.log(m2); | Write to console |
module.exports.a=a | Export variable a |
Npm
Command | Description |
---|---|
npm install <module> | Will install module to your node_modules folder You can then use it in your script by using: var _ = require('underscrore'); |
npm init | Creates a package.json for your project listing dependencies that were installed. |
npm install <package> -S | Add package and add it to the package.json file |
Basic Web Server Example
|
Express.JS
Create an Express
> npm install -g express-generator
> express <app_name>
> cd <app_name> && npm install
> DEBUG=<app_name> ./bin/www
Your app is now running on http://localhost:3000/