# Introduction to node.js

- Speaker: [Ran Mizrahi](/wiki/speakers/ran-mizrahi.md)
- Event: [Reversim Summit 2013](/wiki/years/2013.md)
- Video: https://www.youtube.com/watch?v=hVyHwU1gfjg
- Transcript: [/transcripts/2013/19-hVyHwU1gfjg.md](/transcripts/2013/19-hVyHwU1gfjg.md)
- Language: Hebrew · Type: talk · Level: intermediate
- Topics: [JavaScript](/wiki/topics/javascript.md), [Networking](/wiki/topics/networking.md), [Distributed Systems](/wiki/topics/distributed-systems.md), [Software Engineering](/wiki/topics/software-engineering.md)

> Written by an LLM from machine transcripts. It can contain errors. Check the transcript before you quote it.

## Summary

This talk provides a comprehensive introduction to Node.js, highlighting its architecture, core concepts, and ecosystem. The speaker explains the problem with traditional blocking I/O servers and demonstrates how Node.js utilizes an event loop and non-blocking I/O to handle high concurrency efficiently. Attendees learn how to build basic HTTP servers, use package management with NPM, implement real-time features using WebSockets, and structure web applications with Express and Mongoose.

## Key points

- [1:11](https://www.youtube.com/watch?v=hVyHwU1gfjg&t=71s) Node.js is a server-side JavaScript development platform based on Google Chrome's V8 engine designed for building networking applications.
- [2:11](https://www.youtube.com/watch?v=hVyHwU1gfjg&t=131s) Node.js is single-threaded and non-blocking, utilizing an event loop to handle multiple network connections efficiently.
- [5:15](https://www.youtube.com/watch?v=hVyHwU1gfjg&t=315s) Comparing traditional blocking servers like Apache with event-driven architectures like Nginx and Node.js illustrates the efficiency of non-blocking I/O.
- [9:50](https://www.youtube.com/watch?v=hVyHwU1gfjg&t=590s) Asynchronous programming with callbacks prevents the server from wasting time waiting for database queries or HTTP requests to complete.
- [19:16](https://www.youtube.com/watch?v=hVyHwU1gfjg&t=1156s) NPM serves as the package manager for Node.js, making it easy to install and manage local and global dependencies.
- [22:36](https://www.youtube.com/watch?v=hVyHwU1gfjg&t=1356s) Express is a robust HTTP server framework for Node.js that simplifies routing and request handling compared to using the low-level HTTP module.
- [25:02](https://www.youtube.com/watch?v=hVyHwU1gfjg&t=1502s) Socket.IO enables real-time applications by supporting WebSockets and various fallbacks across different browsers.
- [34:48](https://www.youtube.com/watch?v=hVyHwU1gfjg&t=2088s) Testing in Node.js can be effectively implemented using frameworks like Mocha and assertion libraries like Expect.

## Takeaways

- Adopt non-blocking I/O patterns to handle high concurrency without wasting server resources on waiting for I/O operations.
- Use established frameworks like Express and Socket.IO instead of writing raw HTTP servers from scratch to accelerate development.
- Organize asynchronous code carefully to avoid callback hell and maintain clean, testable application logic.

## Questions this talk answers

- How does Node.js handle high concurrency with a single thread?
- When should I use Node.js instead of traditional thread-per-request servers?
- What are the best practices for structuring asynchronous code and avoiding callback hell in Node.js?

## Technologies

Node.js, JavaScript, V8, Nginx, Apache, Express, Socket.IO, MongoDB, Mongoose, PHP, Ruby, C, C++

## Tags

asynchronous, backend, javascript, networking, nodejs, web development, websockets
