Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Node.js Crash Course - KCDC 2018

3ab1249be442027903e1180025340b3f?s=47 David Neal
July 12, 2018
440

Node.js Crash Course - KCDC 2018

Node.js is a compelling platform that is quickly spreading from startups to the enterprise. Node.js strategically unites developers of all backgrounds through the common language of JavaScript. Why should you learn Node.js and where do you start?

3ab1249be442027903e1180025340b3f?s=128

David Neal

July 12, 2018
Tweet

Transcript

  1. None
  2. None
  3. None
  4. None
  5. None
  6. None
  7. None
  8. None
  9. None
  10. None
  11. None
  12. None
  13. None
  14. None
  15. None
  16. None
  17. None
  18. None
  19. None
  20. None
  21. None
  22. None
  23. TITANIUM SPONSORS Platinum Sponsors Gold Sponsors

  24. None
  25. JavaScript… …has won the Web. Scott Hanselman

  26. Any application that can be written in JavaScript… …will eventually

    be written in JavaScript (search for “jslinux”) Atwood’s Law:
  27. JavaScript… …is tragically important. Douglas Crockford

  28. None
  29. None
  30. None
  31. None
  32. None
  33. None
  34. Up Ahead • Why Node.js? • Crash course • Tools

    and frameworks • Integration strategies
  35. None
  36. None
  37. None
  38. None
  39. None
  40. None
  41. None
  42. ES 2016 (ES6) Support https://kangax.github.io/compat-table/es6/

  43. What’s my story? • ASP.NET MVC, C# • SQL Server

    + NHibernate • JavaScript + JQuery
  44. None
  45. None
  46. What’s my story? • JavaScript • Recruiting • Productive, less

    friction – Testing – Microservices – RabbitMQ, redis – Cross-platform
  47. None
  48. Why Node.js? • Rapid innovation & delivery • Developer happiness

    • Attract & retain talent • Performance “Why Node.js is Becoming the Go-To Technology in the Enterprise” – nearform.com
  49. Why Node.js? productivity satisfaction performance lower costs Improved results year-over-year

    2017 Node.js Foundation User Survey, Executive Summary
  50. Node.js exemplifies… • Start with the simplest solution that works

    • Do one thing, and do it well
  51. • Backend API for SPAs, Mobile apps, etc. • “Serverless”

    computing • Real-time, streaming • WebSockets, push notifications • Chat, IM, social media • DevOps • Microservices Node.js Use Cases
  52. Node.js Use Cases • Backend API for SPAs, Mobile apps,

    etc. • “Serverless” computing • Real-time, streaming • WebSockets, push notifications • Chat, IM, social media • DevOps • Microservices
  53. More than just backend • Create Automation Scripts • Internet

    of Things • Create CLI tools using nexe • Create Desktop Apps
  54. Slack Visual Studio Code

  55. Fandango • dramatically shorter development cycles • micro-services architecture •

    flexibility in deployment • easily scalable infrastructure “Fandango Goes Live with Node.js” – nearform.com
  56. • 2x faster development with fewer developers • 33% fewer

    lines of code • 40% fewer files • 2x improvement requests/sec • 35% decrease in avg response time
  57. • Black Friday, 2013 • Mobile platform • 200,000,000+ users

    • 10 CPU cores, 28 GB RAM • < 1% CPU utilization • Deployed updates
  58. Who else is using Node.js? • NASA • Netflix •

    Amazon • Medium • GE • Wordpress • CapitalOne • eBay • Target • Airbnb • Samsung • GoPro
  59. DevOps • Small footprint • Cross-platform • Event-driven • OSS

    tools • Containers
  60. “What is Node.js used for: The 2015 Node.js Overview Report”

    – blog.risingstack.com
  61. Installing Node.js https://nodejs.org

  62. Installing Node.js Mac or Linux? Use nvm! https://github.com/creationix/nvm Windows? Use

    Chocolatey! https://chocolatey.org/ C:\> choco install nodejs.install > nvm install 8
  63. Installing Node.js > node –v v8.11.3 > npm –v 5.6.0

  64. module-usage-example.js

  65. module-usage-example.js

  66. module-usage-example.js

  67. module-usage-example.js

  68. module-usage-example.js

  69. callback-example-1.js

  70. callback-example-1.js

  71. callback-example-1.js

  72. callback-example-2.js

  73. callback-example-2.js

  74. callback-example-2.js

  75. callback-example-2.js

  76. callback-example-3.js

  77. callback-example-3.js

  78. callback-example-3.js

  79. callback-example-3.js

  80. temperature.js

  81. temperature.js

  82. temperature.js

  83. temperature.js

  84. temperature.js temp-example.js

  85. temperature.js temp-example.js

  86. temperature.js temp-example.js

  87. temperature.js temp-example.js

  88. temperature.js temp-example.js

  89. config.js

  90. config.js

  91. config.js

  92. config.js

  93. config.js

  94. config.js

  95. config.js

  96. config.js cfg-example.js

  97. config.js cfg-example.js

  98. config.js cfg-example.js

  99. config.js cfg-example.js

  100. config.js cfg-example.js

  101. config.js cfg-example.js app.json

  102. sql-example.js

  103. sql-example.js

  104. sql-example.js

  105. sql-example.js

  106. sql-example.js

  107. sql-example2.js

  108. sql-example2.js

  109. sql-example2.js

  110. None
  111. Recommended toolbox Package What it do, yo nodemon automatically restarts

    in dev async async/parallel execution request, axios, or wreck http clients socket.io sockets, real-time jest, mocha, or lab test frameworks testdouble spies, stubs, mocks
  112. Node frameworks MVC • Express • hapi • koa •

    Meteor • Sails API • Restify • LoopBack nodeframework.com
  113. Deploying • Windows – iisnode for web apps – winser

    for services • Linux – forever • Docker
  114. • Run .NET in-process • …including F#, ADO.NET, Python, and

    Powershell • Execute inline code, files, or assemblies • Alternative to writing native modules in C • .NET 4.5 or Mono 3.1
  115. What can Edge.js do? • Leverage existing .NET investment •

    TFS, SharePoint, Exchange, etc. • Active Directory • Hardware (e.g. camera, microphone, printer, win32) • Video encoding, or other CPU-intensive work
  116. Node.js Integration Strategies • Node.js as proxy or nginx •

    request module to call APIs • Messaging (e.g. RabbitMQ, ZeroMQ Azure Service Bus) • Edge.js for .NET
  117. None
  118. None
  119. http://bit.ly/node-crash-course