Node.js Crash Course (That Conference 2016)

Node.js Crash Course (That Conference 2016)

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? You will come away from this talk with the evidence to support Node.js, and tools you need to be productive. We will walk through a typical workflow of creating and debugging a web application. You will learn how easy it is to deploy, including Microsoft Azure. We'll also look at popular frameworks and modules, and other learning resources to give you the best start.

3ab1249be442027903e1180025340b3f?s=128

David Neal

August 09, 2016
Tweet

Transcript

  1. None
  2. None
  3. let trustMe = { has: ["Beard", "Motorcycle"], consumes: ["Bacon", "Caffeine"]

    };
  4. JavaScript… …has won the Web. Scott Hanselman

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

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

  7. None
  8. Up Ahead • Why Node.js? • Crash course • Tools

    and frameworks • Integration strategies
  9. None
  10. None
  11. None
  12. None
  13. None
  14. None
  15. None
  16. ES 2016 (ES6) Support http://node.green

  17. What’s our story? • ASP.NET MVC, C# • SQL Server

    + NHibernate • JavaScript + JQuery
  18. None
  19. None
  20. None
  21. What’s our story? • JavaScript • Recruiting • Productive, less

    friction – Testing – Microservices – RabbitMQ, riak, redis – Cross-platform
  22. None
  23. 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
  24. Node.js exemplifies… • Start with the simplest solution that works

    • Do one thing, and do it well
  25. • Single-page apps • API server (REST, Hypermedia, etc.) •

    Real-time, streaming • WebSockets, push notifications • Chat, IM, social media • Dashboards • Proxy service Node.js Use Cases
  26. Node.js Use Cases • Single-page apps • API server (REST,

    Hypermedia, etc.) • Real-time, streaming • WebSockets, push notifications • Chat, IM, social media • Dashboards • Proxy service
  27. More than just backend • Create Automation Scripts • Create

    CLI tools using nexe • Create Desktop Apps
  28. Atom Atom Slack Visual Studio Code

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

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

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

    • 10 CPU cores, 28 GB RAM • < 1% CPU utilization • Deployed updates
  32. Who else is using Node.js? • Dow Jones (WSJ) •

    eBay • Groupon • LinkedIn • IBM • Redhat • The New York Times • Uber • Yammer • GoDaddy
  33. DevOps • Small footprint • Cross-platform • Event-driven • OSS

    tools
  34. “What is Node.js used for: The 2015 Node.js Overview Report”

    – blog.risingstack.com
  35. Installing Node.js 1. https://nodejs.org 2. Click a download link 3.

    Run installer – OR – Install using Chocolatey (https://chocolatey.org) C:\> choco install nodejs.install
  36. Installing Node.js C:\> node –v v6.3.1 C:\> npm –v 3.10.5

  37. Dependencies – OR – Python 2.x (https://python.org/downloads/ C:\> choco install

    python2
  38. Dependencies – OR – Visual C++ Build Tools 2015 –

    OR – Visual Studio Community 2015 C:\> choco install microsoft-build-tools
  39. Node.js Tools for Visual Studio https://github.com/Microsoft/nodejstools Minimum requirements: • VS

    2012 Pro or VS Community 2013/2015 • Latest VS updates • VS + Node.js Tools Azure VM
  40. None
  41. Visual Studio Code https://code.visualstudio.com/ • Linux, Mac OSX, and Windows

    • code assistance • debugging
  42. C:\projects\myapp> npm init C:\projects\myapp> npm install --save lodash

  43. module-examples.js

  44. module-examples.js

  45. module-examples.js

  46. module-examples.js

  47. module-examples.js

  48. module-examples.js

  49. module-examples.js

  50. temperature.js

  51. temperature.js

  52. temperature.js

  53. temperature.js

  54. temperature.js temp-example.js

  55. temperature.js temp-example.js

  56. temperature.js temp-example.js

  57. temperature.js temp-example.js

  58. temperature.js temp-example.js

  59. config.js

  60. config.js

  61. config.js

  62. config.js

  63. config.js

  64. config.js

  65. config.js

  66. config.js cfg-example.js

  67. config.js cfg-example.js

  68. config.js cfg-example.js

  69. config.js cfg-example.js

  70. config.js cfg-example.js

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

  72. sql-example.js

  73. sql-example.js

  74. sql-example.js

  75. sql-example.js

  76. sql-example.js

  77. Deploying • Windows – iisnode for web apps – winser

    for services • Linux – forever
  78. Hosting Node.js on Azure • New Node JS Empty Site

    • Connect to repository • reverentgeek.com/hosting-node-js-on-microsoft-azure/
  79. Recommended toolbox Package What it do, yo lodash JavaScript utilities

    when JavaScript promise library async async/parallel execution request (or rest) http client gulp build engine, test runner socket.io sockets, real-time node-inspector Debugging mocha test framework chai TDD/BDD assertion library sinon spies, stubs, mocks
  80. Node frameworks MVC • Express • hapi • Meteor •

    Sails API • Restify • LoopBack • Autohost + Hyped nodeframework.com nodewebmodules.com
  81. • 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
  82. 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 • Powershell
  83. Node.js Integration Strategies • Node.js as proxy • Edge.js for

    .NET • request module to call APIs • Messaging (e.g. RabbitMQ, Azure Service Bus)
  84. None
  85. None
  86. Demos + LOTS of Resources bit.ly/node-demos