WRITING APPLICATIONS WITHNODE.JS ON THEMICROSOFT PLATFORMTECHNICAL EVANGELIST, MICROSOFTHTTP://KOUDER.NET – @WRITELINE – D...
WHAT I‘LL COVER• BRIEF OVERVIEW ON NODE.JS• BASIC WORKFLOW ON WRITING NODE.JS APPS• CODE, TEST, DEPLOY• RUNNING NODE.JS ON...
WHAT IS NODE.JS?• A PROCESS HOSTING GOOGLE‘S JAVASCRIPT ENGINE V8• SINGLE THREADED• CODE PATHS ARE MOSTLY ASYNCHRONOUS (IF...
WHY NODE.JS• SERVER-SIDE JAVASCRIPT• GREAT COMMUNITY• FITS GOOD FOR CERTAIN SCENARIOS (FOR INSTANCE STREAMING)
GITHUB REPOSITORYLET‘S CREATE ONE FOR TODAY‘S DEMO
A SIMPLE WEB SERVERvar http = require(http);http.createServer(function (req, res) {res.writeHead(200, {Content-Type: text/...
MODULESexports.helloWorld = function (req, res) {res.writeHead(200, { Content-Type: text/plain });res.end(Hello from node....
INSTALLING MODULES & DEPENDENCIESnpm installnpm search directornpm install director
PACKAGE.JSON & DEPENDENCIES{..."dependencies" : {"director": ">=1.1.0","jade": ">=0.28.1","formidable": ">=1.0.11","union"...
ROUTING WITH DIRECTORvar http = require(http),director = require(director);http.createServer(function(req, res) {router.di...
TEMPLATING WITH JADEh1 Available music to playuleach musicFile in musicli #{musicFile.name}audio(controls, src=#{musicFile...
INTEGRATING AZURE BLOB STORAGEnpm install azurevar azure = require(azure);process.env.AZURE_STORAGE_ACCOUNT = "accountname...
EVENT EMITTERS IN ACTIONvar form = formidable.IncomingForm();form.on(field, function(field, value) {console.log(field, val...
CREATING A VMC:> azure vm create --helphelp: Create a new Azure VMhelp:help: Usage: vm create <dns-name> <image> <userName...
SCALE WITH WINDOWS AZURE
Writing Node.js applications on the Microsoft plattform
Upcoming SlideShare
Loading in...5
×

Writing Node.js applications on the Microsoft plattform

402

Published on

Talk from Web Summit 2012

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
402
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Writing Node.js applications on the Microsoft plattform"

  1. 1. WRITING APPLICATIONS WITHNODE.JS ON THEMICROSOFT PLATFORMTECHNICAL EVANGELIST, MICROSOFTHTTP://KOUDER.NET – @WRITELINE – DPARYS@MICROSOFT.COM
  2. 2. WHAT I‘LL COVER• BRIEF OVERVIEW ON NODE.JS• BASIC WORKFLOW ON WRITING NODE.JS APPS• CODE, TEST, DEPLOY• RUNNING NODE.JS ON A CUSTOM VM
  3. 3. WHAT IS NODE.JS?• A PROCESS HOSTING GOOGLE‘S JAVASCRIPT ENGINE V8• SINGLE THREADED• CODE PATHS ARE MOSTLY ASYNCHRONOUS (IF NOT YOUR APP MAY SUCK)• OPEN SOURCE, MAINTAINED BY JOYENT
  4. 4. WHY NODE.JS• SERVER-SIDE JAVASCRIPT• GREAT COMMUNITY• FITS GOOD FOR CERTAIN SCENARIOS (FOR INSTANCE STREAMING)
  5. 5. GITHUB REPOSITORYLET‘S CREATE ONE FOR TODAY‘S DEMO
  6. 6. A SIMPLE WEB SERVERvar http = require(http);http.createServer(function (req, res) {res.writeHead(200, {Content-Type: text/plain});res.end(Hello Worldn);}).listen(1337, 127.0.0.1);console.log(Server running at http://127.0.0.1:1337/);
  7. 7. MODULESexports.helloWorld = function (req, res) {res.writeHead(200, { Content-Type: text/plain });res.end(Hello from node.js);}
  8. 8. INSTALLING MODULES & DEPENDENCIESnpm installnpm search directornpm install director
  9. 9. PACKAGE.JSON & DEPENDENCIES{..."dependencies" : {"director": ">=1.1.0","jade": ">=0.28.1","formidable": ">=1.0.11","union": ">=0.3.6","icecast": ">=1.1.0","queuestream": ">=0.0.5","azure": ">=0.6.10"},...}
  10. 10. ROUTING WITH DIRECTORvar http = require(http),director = require(director);http.createServer(function(req, res) {router.dispatch(req, res, function(err){if (err) {res.writeHead(404);res.end();};});}).listen(1337);router.get(/, function() {this.res.writeHead(200, { Content-Type: text/plain });this.res.end(Hello from node.js through director);});
  11. 11. TEMPLATING WITH JADEh1 Available music to playuleach musicFile in musicli #{musicFile.name}audio(controls, src=#{musicFile.url})
  12. 12. INTEGRATING AZURE BLOB STORAGEnpm install azurevar azure = require(azure);process.env.AZURE_STORAGE_ACCOUNT = "accountname";process.env.AZURE_STORAGE_ACCESS_KEY = "accountkey";var blobService = azure.createBlobService();
  13. 13. EVENT EMITTERS IN ACTIONvar form = formidable.IncomingForm();form.on(field, function(field, value) {console.log(field, value);}).on(file, function(field, file) {console.log("file type: " + file.type);console.log("file size: " + file.size / 1024 | 0 );console.log("file path: " + file.path);}).on(progress, function(rec, expected){console.log(progress: + rec + " of " + expected);}).parse(req, function(err, fields, files){console.log(Parsed file upload + err );})
  14. 14. CREATING A VMC:> azure vm create --helphelp: Create a new Azure VMhelp:help: Usage: vm create <dns-name> <image> <userName> [password]help:help: Options:help: -h, --help output usage informationhelp: -o, --community The <image> is a community imagehelp: -c, --connect connect to existing VMshelp: -l, --location <name> location of the data centerhelp: -a, --affinity-group <name> affinity grouphelp: -u, --blob-url <url> blob url for OS diskhelp: -z, --vm-size <size> VM size [small]help: extrasmall, small, medium, large, extralargehelp: -n, --vm-name <name> VM namehelp: -e, --ssh [port] enable SSH [22]help: -t, --ssh-cert <pem-file|fingerprint> SSH certificatehelp: -r, --rdp [port] enable RDP [3389]help: -s, --subscription <id> use the subscription idhelp: -w, --virtual-network-name <name> virtual network namehelp: -b, --subnet-names <list> comma-delimited subnet nameshelp: -v, --verbose use verbose outputhelp: --json use json output
  15. 15. SCALE WITH WINDOWS AZURE

×