Skip to content

Instantly share code, notes, and snippets.

@apackin
Created January 18, 2016 20:27
Show Gist options
  • Save apackin/d75eaee370c57a68b6bf to your computer and use it in GitHub Desktop.
Save apackin/d75eaee370c57a68b6bf to your computer and use it in GitHub Desktop.
Node.js

Node.js

"A run time environment"

Node allows us to run javascript on OS instead of browser We need a server to create a website or webapp

###Server A program running on a computer somewhere that can communicate with clients

##Modules moduel.exports = exports specific parts of a program A "require" of the file will return this

##Require Find(with path (. or ./) or assumes its in ./node_modules), execute and import the files

fileB var x = 'foobars'; module.exports = x;

FileA var y = require('./fileB'); console.log(y) // foobars

##npm (node package manager) Command line tool that finds libraries and downloads them, and keeps a list of dependencies in package.json

Asynchronous

  1. kick off some external process
  2. register and event handler that happens when it's done (Callback)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment