Your SlideShare is downloading. ×
0
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
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

NodeJS for Novices - 28/Oct/13 - Winnipeg, MB

522

Published on

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

No Downloads
Views
Total Views
522
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
14
Comments
0
Likes
1
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. NODE FOR NOVICES BRINGING JAVASCRIPT TO THE SERVER An original presentation by David Wesst / @davidwesst PRESENTED AT THE WINNIPEG .NET USER GROUP - OCTOBER 28, 2013 http://www.winnipegdotnet.org
  • 2. DAVID WESST FROM WINNIPEG, MANITOBA SYSTEMS ANALYST, UNIVERSITY OF MANITOBA (FACULTY OF MEDICINE) MICROSOFT MVP, INTERNET EXPLORER IE USER AGENT USERAGENTS.IE PRODUCER, BREWPUB STUDIOS
  • 3. DAVID WESST @DAVIDWESST ON TWITTER DAVIDWESST.COM ON THE WEB DAVIDWESST.COM/BLOG ON THE BLOGOSPHERE DW [AT] DAVIDWESST.COM ON EMAIL
  • 4. FOLLOW ALONG HTTP://DAVIDWESST.GITHUB.IO/DW-PRESENTATIONS
  • 5. SLIDES AND DEMOS WILL BE MADE AVAILABLE AFTERWARDS
  • 6. THE POINT TO ANSWER ONE OF THE FOLLOWING QUESTIONS: What is Node (a.k.a. NodeJS)? What do I need to get started? What makes NodeJS different to ASP.NET? Why aren't my JS frameworks working in NodeJS?
  • 7. THE POINT THEME FOR THIS PRESENTATION UNDERSTAND WHAT YOU CAN DO WITH NODEJS
  • 8. THE PLAN (A.K.A. THE AGENDA) How are we going to do this? What is NodeJS? Getting Yourself Setup Your NodeJS Toolbox Getting Your Node On
  • 9. THE PLAN SETTING YOUR EXPECTATIONS This presentation is... An introduction to NodeJS A dialogue about NodeJS Comparing NodeJS to ASP.NET A review of NodeJS development tools A "core sample" of NodeJS fundamentals
  • 10. WHAT IS NODEJS?
  • 11. WHAT IS NODEJS? "NODE" = "NODEJS"
  • 12. WHAT IS NODEJS? Node is... 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.
  • 13. WHAT IS NODEJS? Node is... ...Server-Side JavaScript ...100% Multi-Platform ...Open Source ...Sponsored by Joyent
  • 14. WHAT IS NODEJS? Node is... ...Powered by Google's V8 JavaScript Engine ...Provides request-level control ...bundled with a package manager (a.k.a npm, node packaged modules) ...Built on the idea of Asynchronous I/O [or Non-Blocking I/O]
  • 15. ASYNCHRONOUS I/O? I/O THAT DOESN'T BLOCK YOUR APPLICATION
  • 16. YOU: I DON'T UNDERSTAND HOW THAT IS POSSIBLE. TELL ME MORE! I WILL.
  • 17. EXAMPLE: CLIENT-SIDE JAVASCRIPT / fn t o w t pr mt r / u ci n ih a ae e f nt o mC in Fn to ( es g, cl bc ) { u ci n yl et u ci nm sa e a la k / v ra l / a i be v rm g =m sa e a s e sg ; / o jc s / bet v rr n oA ry =n wA r y) a ad mr a e ra (; / f nt o cl / u c in al ae tm g; lr ( s) / c l te cl bc / a l h al a k cl bc (; al a k) } ; v rt ea la k= f nt o( { a h C lb c u ci n ) / .. o sm ti g /. d oe hn } m Ci nF nt o( e sg ,t ea l ak ; y le t uc in ms ae hC lb c)
  • 18. EXAMPLE: SERVER-SIDE (NODEJS) JAVASCRIPT / fn t o w t pr mt r / u ci n ih a ae e f nt o mS re Fn to ( es g, cl bc ) { u ci n ye vr u ci nm sa e a la k / v ra l / a i be v rm g =m sa e a s e sg ; / o jc s / bet v rr n oA ry =n wA r y) a ad mr a e ra (; / f nt o cl / u c in al cn oe lg mg ; os l .o (s ) / c l te cl bc / a l h al a k cl bc (; al a k) } ; v rt ea la k= f nt o( { a h C lb c u ci n ) / .. o sm ti g /. d oe hn } m Sr eF nt o( e sg ,t ea l ak ; y ev r uc in ms ae hC lb c)
  • 19. THE SECRET IS... CALLBACKS
  • 20. CALLBACKS CALLBACK ARE THE SECRET TO NON-BLOCKING OPERATIONS On the client, UI is kept unblocked On the server, Requests are unblocked
  • 21. OPTIONAL DEMO: CALLBACKS
  • 22. WHERE IS NODE BEING USED IN PRODUCTION? REAL EXAMPLES Nodejitsu, Cloud Platform LinkedIn Ebay
  • 23. LET'S TALK NODEJS AND JAVASCRIPT FRAMEWORKS (LIKE BACKBONEJS)
  • 24. GETTING YOURSELF SETUP
  • 25. WHAT ARE YOU GOING TO NEED? Your development machine (Windows, Linux, or Mac) An Internet Connection (OPTIONAL) A bit of comfort with a command line
  • 26. HOW ARE YOU GOING TO DO IT? WINDOWS AND MAC 1. 2. 3. 4. Go to NodeJS.org Download the installer Follow the install wizard Test it in the CLI (command line interface)
  • 27. YOUR NODEJS TOOLBOX
  • 28. CORE TOOLBOX: TEXT EDITOR + TERMINAL THIS IS PRETTY GOOD TO GET YOU GOING Vi Notepad GEdit TextMate
  • 29. NODEJS TOOLS: NODECLIPSE / NODE IDE HTTP://WWW.NODECLIPSE.ORG/ Eclipse Plugin(s) Free and Open Source Adds NodeJS running and debugging support in Eclipse Very young project, but provides what you need
  • 30. NODEJS TOOLS: CLOUD9 HTTP://C9.IO Hosted IDE Free and Paid Options Open Source Provides support for major web platforms Includes other common development features, like MySQL and Terminal
  • 31. NODEJS TOOLS: WEBMATRIX HTTP://WWW.MICROSOFT.COM/WEB/WEBMATRIX/ Windows Application from Microsoft Free Environment for popular web platforms (Node, Rails, PHP, HTML5, ASP.NET) Meant for development of Web Sites over Web Apps
  • 32. NODEJS TOOLS WebStorm IDE by JetBrainsLink Netbeans Plugin Link Visual Node (Private Beta) by RedgateLink
  • 33. GETTING YOUR NODE ON
  • 34. WARMING UP TO NODE NODE PROJECTS ARE MADE UP OF THE FOLLOWING: "App.js" - Your Main Executable File "Package.json" (OPTIONAL) - Describes details of your application "node_modules/" (OPTIONAL) - Contains project dependencies
  • 35. DEMO INTRODUCING NODEJS
  • 36. USING THE NPM NODE PACKAGED MODULES NPM is bundled with Node base install as of v0.6.3 Packages can be browsed at NPMjs.org Installs packages either locally n mi sa lu dr c r p n t l ne so e ...or globally n mi sa l- t ps rp p n t l g y e ci t
  • 37. PACKAGE.JSON: REVISITED THE KEYS TO USING THE NPM You can... Define dependencies for running your application Define dependencies for developing your application Set the name, version, and main for your own apps and packages Publish your own packages to the npm
  • 38. DEMO: USING NPM COMMAND LINE
  • 39. PRO TIP
  • 40. GITHUB IS YOUR FRIEND
  • 41. CODING WITH CALLBACKS USING THE REAL POWER OF NODEJS Keys to remember: Functions are first-class citizens in JavaScript Functions can be passed as arguments Defining functions inside of functions makes them "private" Non-blocking means user waits less, which is good!
  • 42. CODING WITH CALLBACKS
  • 43. DEMO CODING WITH CALLBACKS
  • 44. MAKING YOUR OWN MODULES MODULARITY FOR THE WIN Keys to remember: Modules provide a way to easily organize your code Can be shared amongst other projects Published through npm or git repository Version is defined in package.json
  • 45. DEMO MAKING YOUR OWN MODULES
  • 46. THINGS TO REMEMBER Private and Public variables exist Think Modular NPM is your friend ...and so is Github
  • 47. LET'S TALK NODEJS AND MICROSOFT STUFF
  • 48. NODEJS AND MICROSOFT Websites and Cloud Services support in Windows Azure IDE built into WebMatrix IIS and IIS Support through IISNode
  • 49. ASP.NET VS NODEJS Serves up JavaScript and HTML Natively Synchronous Requires IIS Provides multiple structured ways of doing web (Web Forms, MVC, Websites, WebAPI)
  • 50. ASP.NET VS NODEJS Serves up JavaScript and HTML Natively Asynchronous Does not require web server (e.g. IIS) Provides multiple unstructured ways of doing web Open Source
  • 51. PRO TIP
  • 52. EXPRESSJS: YOUR NEW FAVOURITE NODE MODULE POPULAR MVC FRAMEWORK FOR NODE Provides MVC Pattern for Web Applications Supports Popular Middle Modules Command-Line Setup Supports popular UI tools (e.g. LESS, SASS, Jade Templates)
  • 53. DEMO INTRODUCTION EXPRESSJS
  • 54. THE PLAN (A.K.A. THE AGENDA) How are we going to do this? What is NodeJS? Getting Yourself Setup Your NodeJS Toolbox Getting Your Node On
  • 55. THE POINT TO ANSWER ONE OF THE FOLLOWING QUESTIONS: What is Node (a.k.a. NodeJS)? What do I need to get started? What makes NodeJS different to ASP.NET? Why aren't my JS frameworks working in NodeJS?
  • 56. THE POINT THEME FOR THIS PRESENTATION UNDERSTAND WHAT YOU CAN DO WITH NODEJS
  • 57. NEXT STEPS Where do we go from here?
  • 58. NEXT STEPS Install NodeJS Create a NodeJS Application with or without ExpressJS Explore the npm Publish a package to the npm
  • 59. NEXT STEPS CHECK OUT A RESOURCE http://package.json.nodejitsu.com/ http://blog.nodejitsu.com/npm-cheatsheet http://npmjs.org
  • 60. DAVID WESST FROM WINNIPEG, MANITOBA SYSTEMS ANALYST, UNIVERSITY OF MANITOBA (FACULTY OF MEDICINE) MICROSOFT MVP, INTERNET EXPLORER IE USER AGENT USERAGENTS.IE PRODUCER, BREWPUB STUDIOS
  • 61. DAVID WESST @DAVIDWESST ON TWITTER DAVIDWESST.COM ON THE WEB DAVIDWESST.COM/BLOG ON THE BLOGOSPHERE DW [AT] DAVIDWESST.COM ON EMAIL

×