Your SlideShare is downloading. ×
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Introduction Node.js
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Introduction Node.js

4,550

Published on

Introduction to software development with Node.js

Introduction to software development with Node.js

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

No Downloads
Views
Total Views
4,550
On Slideshare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
113
Comments
0
Likes
18
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Introduction Node.js ERIK VAN APPELDOORN | MARCH 28TH 2014 | SDN EVENT
  • 2. About me  Erik van Appeldoorn Trainer | Consultant  Avans Hogeschool, Academie Industrie & Informatica  Twitter: @evappeld  Blog: codeagainstthecode.tumblr.com  Mail: erixio@xs4all.nl
  • 3. Subjects
  • 4. JavaScript WHY?  Unstructured  Not intuitive  Unlogical  Prototypical Inheritance… WTF?  Dynamically typed  No Intellisense/code completion  Hard to debug  Global variables
  • 5. JavaScript is strange (I) console.log(1 == true); //true console.log(1 === true); //false console.log("0" == false); //true console.log("abc" == "a" + "b" + "c"); //true console.log(null == undefined); //true console.log(30 -"7"); //23 console.log("30" + 7); // 307
  • 6. JavaScript is strange (II) function rectangle(x,y) { this.x = x; this.y = y; } rectangle.prototype.area = function() { return this.x * this.y; } var twoByThree = new rectangle(2,3); console.log(twoByThree.area());
  • 7. But…JavaScript is relevant  THE language of the WEB  Cross-platform  Huge REACH  JavaScript is everywhere (client, server, libs, frameworks)  Single Page Applications  Server applications  End-to-End JavaScript applications
  • 8. Learn JavaScript!
  • 9. JavaScript the good parts http://www.youtube.com/watch?v=hQVTIJBZook Dough Crockford
  • 10. Learning JavaScript  http://www.codecademy.com/tracks/javascript  http://www.w3schools.com/js/default.asp  http://eloquentjavascript.net/  Learn Node.js
  • 11. What is Node.js?  Open Source, Cross platform Development platform  Uses V8 JavaScript engine (Google)  “JavaScript on the server”  Node.js is a command line tool
  • 12. Node.js history  Developed in 2009  Published in 2011 (Linux only)  Ryan Dahl, Joyent  From July 2011 Windows version available  Active community: check http://nodeconf.com/
  • 13. Node.js architecture  Node.js is event-driven with Non-blocking I/O  Uses a Event loop for Non-blocking I/O  Node.js is single threaded
  • 14. Node.js Event loop
  • 15. Node.js applications “Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.”  HTTP server  REST server  Web Sockets  TCP server  Utillities Building Scalable Network programs
  • 16. Hello Node.js World!
  • 17. Hello Node.js World! + http server
  • 18. http://nodejs.org/download/
  • 19. Text editor  JetBrains WebStorm  Sublime Text  Visual Studio + Node.js tools for Visual Studio  Nodeclipse  Cloud9
  • 20. Node Package Manager (NPM)  www.npmjs.org  60.000+ modules  package.json file (npm init)  npm install <module.name> --save  DEMO
  • 21. Polular NPM modules express mocha restify jade socket.io redis underscore mongoose moment request async connect grunt passport
  • 22. Local modules  DEMO
  • 23. Node.js Website with express + jade
  • 24. Node.js Website with express + jade  Express: http://expressjs.com/  Connect: http://www.senchalabs.org/connect/  Jade: http://jade-lang.com/  DEMO Connect
  • 25. Features express: Routing
  • 26. Features express: Views  DEMO Express + Jade
  • 27. Node.js REST API with Restify
  • 28. Restify  Maps HTTP verbs to CRUD operation  Handles URL & Body params  RESTIFY: http://mcavage.me/node-restify/
  • 29. Restify  DEMO Restify
  • 30. WebSockets
  • 31. Node.js WebSockets with Socket.io
  • 32. Socket.io  Bi-directional communication  WebSockets + fallbacks  SOCKET.IO: http://socket.io/
  • 33. Socket.io  DEMO Socket.io Server Client
  • 34. Node.js with Mongoose & MongoDB
  • 35. MongoDB  NoSQL document store  JSON collections  MongoDB: http://www.mongodb.org/  Robomongo: http://robomongo.org/
  • 36. Mongoose  Object modelling for MongoDB  Define schemas in Node.js for MongoDB  Query building (ODM)  Mongoose: http://mongoosejs.com/
  • 37. Mongoose  DEMO Mongoose & MongoDB
  • 38. The MEAN stack http://www.mean.io
  • 39. QUESTIONS?

×