Anúncio

Breaking the eggshell: From .NET to Node.js

Data Solution Architect at Microsoft em Microsoft
28 de May de 2015
Anúncio

Mais conteúdo relacionado

Anúncio

Mais de Barbara Fusinska(20)

Anúncio

Breaking the eggshell: From .NET to Node.js

  1. Breaking the eggshell: From .NET to Node.js Barbara Fusinska @basiafusinska barbarafusinska.com
  2. About me Programmer Geek Sweet tooth
  3. Objectives
  4. Agenda • When, why & what? • But… Windows • Application building crash course – Development environment setup – Creating the web application – Async library – Working with databases • Managing the application – Testing – Debugging
  5. What is Node.js? An open-source platform built on JavaScript runtime that uses an event-driven, non-blocking I/O model for easily creating lightweight server-side and networking applications.
  6. Why is it so cool? • Platform independent • Scalable • Faster • Lightweight • Optimised
  7. JavaScript If you still don't think JavaScript has won the web, please read on. Is JavaScript tragically important? Any application that can be written in JavaScript will eventually be written in JavaScript It’s a cancer (Node.js)
  8. Prototype approach support • Easy onboard • Simple programming model • Simple solution that works
  9. A bit of an architecture…
  10. How to choose? • CLR – multithreaded engine, CPU heavy operations • Node.js – single thread, leightweight I/O heavy systems, async everything
  11. Cross platform
  12. Simplicity
  13. Community • .NET – well established, Patterns & Practices • Node.js – considered simpler, just works
  14. But… Windows • Node runs on Windows • Node can run inside IIS • Node can run on Windows Azure • Cross-platform handling: – VM – Containers
  15. Node Tools for VS
  16. VS Code
  17. Installation & configuration
  18. Package Management • NuGet -> npm • .nuget/packages.config -> packages.json • packages -> nodes_modules
  19. npm
  20. Development environment • IDE • Running the app • Organising the project • Dependencies
  21. Running Node.js app
  22. Nodemon
  23. Task runners • Why? -> automation • What?: – Tests – Building css files – Loading libraries – Running – Deployment
  24. Gruntfile
  25. Updating statuses
  26. How API Web App GET api/events POST api/events/:username
  27. Creating web app ASP.NET MVC, WebAPI Express Razor SignalR Vash.js Socket.io
  28. Creating express app
  29. Express vs. Asp.NET MVC
  30. Organising the code
  31. App.js
  32. Routing
  33. Passing model
  34. Jade
  35. Callbacks
  36. Async
  37. Async solution
  38. Databases • MongoDB • Cassandra • CouchDB • ElasticSearch • Redis • PostgreSQL • MySql • MS Sql Server • Oracle
  39. Set up the connection to MySql
  40. Querying MySql
  41. Testing • Testing – Jasmine – Mocha – Expresso (no longer maintained) – Should – Karma • Mocks – Sinon – Mock – NodeMock
  42. Jasmine
  43. Mocks
  44. Tests in task manager
  45. Running tests
  46. Debugging – node-inspector
  47. node-inspector debugging
  48. Debugging – VS Code
  49. Summary • Why consider Node.js? • Introduction – Development environment – Building the application – Node concepts – Maintenance
  50. Questions? Barbara Fusinska @basiafusinska barbarafusinska.com https://github.com/BasiaFusinska/FromNet2Node
Anúncio