Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js
  • NODE.js is an open source and cross platform runtime environment for executing JavaScript code outside of a browser
  • Often used to build backend services (APIs - Aplication Programming Interfaces)
  • Is ideal for building highly-scalable, data-intensive and real-time backend services. Good points:
    • Great for prototyping and agile development
    • Superfast and highly scalable  
    • Is JavaScript like in front end (don't have to learn a new programming language)
    • Cleaner and more consistent codebase
    • Large ecosystem of open-source libs
  • Real example: Paypal migrated an app from Java and was built twice as fast with fewer people, with 33% fewer lines of code, 40% fewer files and 2x request/sec with a 35% faster response time
  • Browsers have their own JS Engine to execute JavaScript code: Chakra (Microsoft Edge), SpiderMonkey (Firefox), v8 (Chrome)... Different engines means that sometimes JavaScript code can behave differently in one browser or another.
  • In 2009, Ryan Dahl (creator of Node) got the idea to execute JS outside of a browser. He tooks Google's v8 engine (the fastest engine) and embedded it inside a C++ program and called it Node.
  • Node is a program that includes a v8 JavaScript engine plus additional modules that give capabilities not available inside browsers (file system, network...). Both use the same engine, with different runtime environment.
  • Node has a non-blocking (asynchronous) architecture. A single thread handle all requests in an event queue.
    • Is ideal for I/O intensive apps or network access (we can serve more clients without need to throw in more hardware) and is highly scalable
    • Node should not be used for CPU-intensive apps (video encoding, image manipulation services...). As a single thread app, when performing the calculations to serve one client, other clients have to wait.

 

  • node --version // Get the current installed version

Getting started

Fernando Picos
Module by Fernando Picos, updated more than 1 year ago
No tags specified