Last active
August 29, 2015 14:01
-
-
Save mathildathompson/6c0446d977ce4d9aa55a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//nodejs.org | |
//CANARY is the next version of CHROME; | |
//CHROMIUM -> CANARY -> CHROME: | |
node //Type this into terminal; | |
//Node is now running on the server on ts own; | |
0.1 + 0.2 | |
console.log('hi'); | |
//It is so fast as it has not features out of the box; | |
//Bare bones, all driven by callBacks;Uses those same ideas over and over again; | |
node hello.js | |
//Node is a console versoin of Javascript; | |
//Good for making lightweight fast servers; | |
//Node.js just prints helloWorld to the user when they visit the page. The rails server will freak out when you have 5000 connecctions, the node server can connect a million to the people and it wont give a shit; | |
//CoffeeScript the compiler is written in Javascript; | |
var http = require('http'); //This is like a module, puts the library into a variable into http; | |
http.createServer(function (req, res) { //This is going to create a server, the request info about the request, the resource is the response that you are sending back; | |
res.writeHead(200, {'Content-Type': 'text/plain'}); //You have to send your own headers, tell it the content type; | |
res.end('Hello World\n'); //End the response; | |
}).listen(1337, '127.0.0.1'); //Use post 1337 cause someone though this port would be elite! | |
console.log('Server running at http://127.0.0.1:1337/'); | |
node server.js | |
http://127.0.0.1:1337/ //Put this into browser; | |
//nmp is the node package manageer, is the node equivalent of gem files; | |
//Manifest.JSON file, you can use NPM to download all of the node packages that you need; | |
//VLAD GUEST SPEAKER | |
//Node.js is a Javascript platform, crossPlatform; | |
//Simple servers, single page applications; | |
//Node is modular over 60 000 modules; | |
//Ruby on Rails, you have to download the whole framework, in Node you can choose the modules that you want; | |
//Node.js works well with JSON APIs; | |
//NMP the node package manager, get all your APM modules; | |
//File System API; | |
//HTTP API lets you create servers; | |
//STREAM | |
//Setting up a new Node project | |
sudo npm install -g jshint | |
jshint --verbose app.js | |
npm init//Initialize a new project //Create package-JSON file with the name and the version; | |
npm install express --save //Puts express into our dependencies; --save dev will put into developer dependencies; | |
_dirname //Means this directory | |
Bower //Like npm, goal is to get latest versions of jQuery & 3JS; | |
//Validator for the format of Javascript code; | |
TRYGHOST // | |
https://speakerdeck.com/vladikoff/node-dot-js-intro-general-assembly; | |
//Node in place of rails, but still using PostGres; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment