42
Node.js for .NET Developers Speaker: David Neal Moderator: Alvin Ashcra< May 14, 2015 May 14 – 15, 2015 2015 Microso< MVP Virtual Conference

Node.js for .NET Developers

Embed Size (px)

Citation preview

Page 1: Node.js for .NET Developers

Node.js  for  .NET  Developers  Speaker:  David  Neal  Moderator:  Alvin  Ashcra<  May  14,  2015  

May  14  –  15,  2015  

2015  Microso<  MVP  Virtual  Conference  

Page 2: Node.js for .NET Developers

Your Presenter

David  Neal  -­‐>  reverentgeek.com  -­‐>  @reverentgeek    var  trustMe  =  {      consumes:  ["Bacon",  "Caffeine"],      facialHair:  true,      knowsHowToComputer:  true,      mvp:  "ALM"  }  

Page 3: Node.js for .NET Developers

Your Moderator

Alvin  Ashcraft  -­‐>  alvinashcraft.com  -­‐>  @alvinashcraft    var  alvin  =  {      title:  "Software  Architect",      yearsExperience:  20,      facialHair:  true,      knowsHowToComputer:  true,      mvp:  ".NET"  }  

Page 4: Node.js for .NET Developers

Up Ahead

•  Why Node.js? •  Crash course •  Tools and frameworks •  Integration strategies

Page 5: Node.js for .NET Developers

JavaScript… …has won the Web.

– Scott Hanselman

Page 6: Node.js for .NET Developers

Anything that can be written in JavaScript…

…will eventually be written in JavaScript

– Somebody with incredible powers of observation

(go search for “jslinux”)

Page 7: Node.js for .NET Developers

JavaScript… …is tragically important.

– Douglas Crockford, Author of “JavaScript: The Good Parts”

Page 8: Node.js for .NET Developers
Page 9: Node.js for .NET Developers
Page 10: Node.js for .NET Developers
Page 11: Node.js for .NET Developers
Page 12: Node.js for .NET Developers
Page 13: Node.js for .NET Developers
Page 14: Node.js for .NET Developers
Page 15: Node.js for .NET Developers

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

Page 16: Node.js for .NET Developers

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

Page 17: Node.js for .NET Developers

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

•  Cross-platform

Page 18: Node.js for .NET Developers
Page 19: Node.js for .NET Developers

“What is Node.js used for: The 2015 Node.js Overview Report” – blog.risingstack.com

Page 20: Node.js for .NET Developers

Node.js exemplifies…

Start with the simplest solution that works.

Do one thing, and do it well.

Page 21: Node.js for .NET Developers

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

Page 22: Node.js for .NET Developers

Fandango •  dramatically shorter development cycles •  micro-services architecture •  flexibility in deployment •  easily scalable infrastructure

“Fandango Goes Live with Node.js” – nearform.com

Page 23: Node.js for .NET Developers

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

Page 24: Node.js for .NET Developers

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

Page 25: Node.js for .NET Developers

Who else is using Node.js? •  Dow Jones (WSJ) •  eBay •  Groupon •  LinkedIn •  Rdio

•  Shutterstock •  The New York Times •  Uber •  Yammer •  Zendesk

nodjs.org/industry

Page 26: Node.js for .NET Developers

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

Page 27: Node.js for .NET Developers

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  

Page 28: Node.js for .NET Developers

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

Page 29: Node.js for .NET Developers

Dependencies

– OR – Python 2.x (https://python.org/downloads/

C:\> choco install python2  

Page 30: Node.js for .NET Developers

Dependencies

– OR – Visual C++ 2010 Express

C:\> choco install VCExpress2010  

Page 31: Node.js for .NET Developers

Node.js Tools for Visual Studio http://nodejstools.codeplex.com https://github.com/Microsoft/nodejstools Minimum requirements: •  VS 2012 Pro

or VS Community 2013

•  Latest VS updates •  VS + Node.js Tools Azure VM

Page 32: Node.js for .NET Developers

Visual Studio Code https://code.visualstudio.com/ •  Linux, Mac OSX,

and Windows •  code assistance •  debugging

Page 33: Node.js for .NET Developers
Page 34: Node.js for .NET Developers

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

Page 35: Node.js for .NET Developers

Hosting Node.js on Azure •  Login to Azure portal •  Click +New •  Choose Compute > Website > From Gallery •  Choose Templates > Node JS Empty Site •  Connect to repository such as GitHub for automatic

deployments •  reverentgeek.com/hosting-node-js-on-microsoft-azure/

Page 36: Node.js for .NET Developers

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

Page 37: Node.js for .NET Developers

Node frameworks MVC •  Express •  Meteor •  Sails •  Hapi

API •  Restify •  LoopBack •  Autohost

nodeframework.com nodewebmodules.com

Page 38: Node.js for .NET Developers

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

Page 39: Node.js for .NET Developers

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

Page 40: Node.js for .NET Developers

.NET + Node.js Integration •  Edge.js •  request module to call .NET Web API •  Messaging (e.g. RabbitMQ, Azure Service Bus)

Page 41: Node.js for .NET Developers
Page 42: Node.js for .NET Developers

David Neal

@ReverentGeek

[email protected]

reverentgeek.com

Thank You!

Demos + Resources

bit.ly/node-demos