Slide 1

Slide 1 text

Intro to Node.js (for .NET Developers) David Neal | reverentgeek.com | @reverentgeek var trustMe = { consumes: ["Bacon", "Caffeine"], hasBeard: true, knowsHowToComputer: true }

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

Y2K

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Up Ahead •  Why Node.js? •  Crash course •  Tools and frameworks •  Deployment

Slide 7

Slide 7 text

JavaScript… …has won the Web. – Scott Hanselman

Slide 8

Slide 8 text

Anything that can be written in JavaScript… …will eventually be written in JavaScript – Somebody with incredible powers of observation (e.g., search for “jslinux”)

Slide 9

Slide 9 text

JavaScript… …is tragically important. – Douglas Crockford, Author of “JavaScript: The Good Parts”

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

Node.js exemplifies… Start with the simplest solution that works. Do one thing, and do it well.

Slide 18

Slide 18 text

Node.js is… •  blazing fast •  highly concurrent •  low-friction •  cross-platform •  modern web server

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

•  2x faster development with fewer developers •  33% fewer lines of code •  40% fewer files •  2x improvement requests/sec •  35% decrease in avg response time

Slide 21

Slide 21 text

“We are seeing big scale gains, performance boosts and big developer productivity.”

Slide 22

Slide 22 text

•  Black Friday, 2013 •  Mobile platform •  < 1% CPU utilization •  200,000+ concurrent users

Slide 23

Slide 23 text

NBC Universal •  ASP.NET to Node.js •  300 million page views/month •  Start render time: 8.8 to 1.3 seconds •  Page speed: 100+ to <10 seconds NBC News, Today.com, CNN…

Slide 24

Slide 24 text

Who else is using Node.js? •  Dow Jones (WSJ) •  eBay •  Groupon •  LinkedIn •  Rdio •  Shutterstock •  The New York Times •  Uber •  Yammer •  Zendesk nodjs.org/industry

Slide 25

Slide 25 text

Node.js Use Cases •  Single-page apps •  API server (REST, Hypermedia, etc.) •  Real-time, streaming, WebSockets •  Chat, IM, social media •  Dashboards •  Proxy service In other words… the INTERNET

Slide 26

Slide 26 text

io.js •  Fork of node.js •  Latest Chrome V8, ES6 •  Open governance

Slide 27

Slide 27 text

What’s our story? •  ASP.NET MVC, C# •  SQL Server + NHibernate •  JavaScript + JQuery

Slide 28

Slide 28 text

What’s our story? •  JavaScript •  Recruiting •  Productive, less friction –  Testing –  Microservices –  RabbitMQ, riak, redis •  Cross-platform

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

Ready to jump in?

Slide 31

Slide 31 text

Installing Node.js 1.  http://nodejs.org 2.  Click big, green INSTALL 3.  Run installer – OR – Install using Chocolatey (http://chocolatey.org) C:\> choco install nodejs.install  

Slide 32

Slide 32 text

Installing Node.js C:\> node –v v0.10.38 C:\> npm –v 1.4.28  

Slide 33

Slide 33 text

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

Slide 34

Slide 34 text

Dependencies – OR – Visual C++ 2010 Express C:\> choco install VCExpress2010  

Slide 35

Slide 35 text

Node.js Tools for Visual Studio Minimum requirements •  VS 2012 Pro or VS 2013 Express •  Latest VS updates http://nodejstools.codeplex.com

Slide 36

Slide 36 text

Hey y’all watch this…

Slide 37

Slide 37 text

Other editors •  Sublime Text 3 •  Atom •  WebStorm

Slide 38

Slide 38 text

Debugging C:\> node debug hello.js  

Slide 39

Slide 39 text

Debugging C:\> node debug hello.js  

Slide 40

Slide 40 text

Debugging C:\> node install –g node-inspector  

Slide 41

Slide 41 text

Debugging C:\> node install –g node-inspector   C:\> node-debug hello.js  

Slide 42

Slide 42 text

Deploying •  Don’t include node_modules folder •  …unless you create builds for specific targets •  Azure is super-easy •  Windows –  iisnode for web apps –  winser for services •  Linux – forever

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

Hosting Node.js on Azure reverentgeek.com/hosting-node-js-on-microsoft-azure/

Slide 49

Slide 49 text

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

Slide 50

Slide 50 text

Node frameworks MVC •  Express •  Meteor •  Sails •  Hapi API •  Restify •  LoopBack •  Autohost nodeframework.com nodewebmodules.com

Slide 51

Slide 51 text

No content

Slide 52

Slide 52 text

Edge.js •  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

Slide 53

Slide 53 text

What can Edge.js do? •  Leverage existing .NET investment •  SQL Server (or other DBs) •  TFS, SharePoint, Exchange, etc. •  Active Directory •  Hardware (e.g. camera, microphone, printer, win32) •  Video encoding, or other CPU-intensive work •  Powershell

Slide 54

Slide 54 text

.NET + Node.js Integration •  Edge.js (possible migration strategy) •  request module to call .NET Web Services •  Messaging (e.g. RabbitMQ)

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

Thank you! David Neal @ReverentGeek [email protected] reverentgeek.com Demos + Resources bit.ly/node-demos Please rate me! h#p://spkr8.com/t/54801