Introduction Node.js
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Introduction Node.js

on

  • 1,957 views

Introduction to software development with Node.js

Introduction to software development with Node.js

Statistics

Views

Total Views
1,957
Views on SlideShare
1,947
Embed Views
10

Actions

Likes
7
Downloads
54
Comments
0

4 Embeds 10

https://www.linkedin.com 4
http://www.slideee.com 3
http://lanyrd.com 2
http://ngoding.co 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Introduction Node.js Presentation 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?