What is NodeJS?

Piyush Garg
3 Jan 202307:44

Summary

TLDRThis video introduces Node.js, explaining its role as a runtime environment for executing JavaScript outside of the browser. The tutorial dives into how JavaScript traditionally only runs within browsers using JavaScript engines, like Chrome's V8 engine. Node.js extracts this engine to allow JavaScript to run on machines, enabling server-side capabilities like file handling and web server creation. The video also covers how Node.js works with C++ to interact with system-level functionalities. Overall, it's a foundation for understanding Node.js and its benefits for developers looking to run JavaScript beyond the browser.

Takeaways

  • 😀 Node.js allows JavaScript to execute outside the browser, transforming JavaScript into a server-side language.
  • 🤔 JavaScript traditionally ran only inside the browser because it required a JavaScript engine, such as V8 in Chrome, SpiderMonkey in Firefox, or Apple's JavaScript engine in Safari.
  • 🚀 Node.js is not a framework or library but a runtime environment that uses the V8 engine to execute JavaScript code outside the browser.
  • 💻 Node.js makes it possible to interact with machine-level operations, such as file handling, using JavaScript due to its C++ core integration.
  • 🔗 Node.js is powered by the V8 engine, originally developed for Google Chrome, which was extracted and embedded with C++ to run independently from the browser.
  • 🛠 With Node.js, JavaScript can interact with hardware, files, and operating systems, much like other server-side languages such as C++.
  • 📈 The V8 engine is highly popular and widely used across various platforms due to its efficiency and speed.
  • 🌐 Node.js enables the creation of web servers, REST APIs, and more by leveraging JavaScript's capabilities outside the browser environment.
  • 🧑‍💻 The Node.js REPL (Read-Eval-Print Loop) allows developers to execute JavaScript code directly in the terminal, similar to how it would run in a browser.
  • 📖 Having a good understanding of JavaScript is crucial before diving into Node.js, as it is built upon JavaScript fundamentals.

Q & A

  • What is the main focus of the tutorial series mentioned in the transcript?

    -The main focus of the tutorial series is to cover the basics of Node.js, including what it is, how it works, and its benefits.

  • What is Node.js according to the transcript?

    -Node.js is described as a runtime environment for JavaScript that allows JavaScript to be executed outside of the browser.

  • Why is JavaScript limited to the browser according to the transcript?

    -JavaScript is limited to the browser because it is designed to be executed by the JavaScript engine present within the browser.

  • What is a JavaScript engine as mentioned in the transcript?

    -A JavaScript engine is a software component that can interpret and execute JavaScript code within a web browser.

  • Which JavaScript engine is mentioned as the most popular in the transcript?

    -The V8 engine, which is used by Google Chrome, is mentioned as the most popular.

  • What benefit does embedding the V8 engine with Node.js provide?

    -Embedding the V8 engine with Node.js allows JavaScript to be executed outside of the browser, enabling interaction with the native machine functionalities.

  • How does the ability to execute JavaScript outside the browser change with Node.js?

    -With Node.js, JavaScript can be executed on the server-side, enabling tasks such as file handling and other machine-level operations that are not possible in a browser environment.

  • What is the significance of the V8 engine being extracted from Chrome and used in Node.js?

    -Extracting the V8 engine from Chrome and using it in Node.js allows developers to use JavaScript for server-side scripting and applications, expanding the use of JavaScript beyond the browser.

  • What does the term 'event-driven' mean in the context of Node.js as discussed in the transcript?

    -In the context of Node.js, 'event-driven' refers to the architecture that allows the server to handle asynchronous events, making it efficient for handling multiple requests simultaneously.

  • How does the presence of Node.js change the way developers interact with JavaScript?

    -Node.js allows developers to use JavaScript for both client-side and server-side scripting, unifying the language used across different parts of an application.

  • What is the role of the command line when using Node.js as per the transcript?

    -The command line is used to execute JavaScript code outside the browser using Node.js, allowing for interactive terminal-based scripting and execution.

Outlines

00:00

👨‍💻 Introduction to Node.js and Its Environment

The first paragraph introduces the audience to Node.js and the tutorial series. It starts by discussing what Node.js is, explaining that it allows JavaScript to run outside the browser. JavaScript traditionally runs within a browser using a JavaScript engine like Chrome's V8, Firefox's SpiderMonkey, or Safari's Apple engine. These engines enable JavaScript execution, but only within the browser. The paragraph dives into how Node.js, powered by the V8 engine, extends JavaScript's capability beyond browsers, allowing developers to use JavaScript to build web servers and other non-browser-based applications. The foundation is laid for understanding Node.js as more than a framework or library—it is a runtime environment that allows JavaScript to be executed in a non-browser environment through C++ integration, making JavaScript a server-side language.

05:01

🔧 Demonstrating Node.js and REPL Environment

The second paragraph demonstrates how JavaScript can be executed both inside and outside a browser. The author shows a simple `console.log` example in the browser, explaining how it runs using the V8 engine. The focus then shifts to executing the same code in Node.js within a machine's terminal. By using the Node REPL (Read-Eval-Print Loop), JavaScript can run outside the browser, utilizing Node's runtime environment. The paragraph further emphasizes that Node.js is a runtime environment for executing JavaScript beyond the browser, with practical demonstrations of running code on both platforms. Finally, it highlights the open-source nature of Node.js and encourages viewers to explore more through its official website, especially before diving deeper into the tutorial series.

Mindmap

Keywords

💡Node.js

Node.js is a runtime environment that allows JavaScript to be executed outside of a web browser. In the video, Node.js is described as a platform that enables server-side execution of JavaScript, transforming JavaScript from a client-side language to one that can also perform back-end functions, like handling files or connecting to databases.

💡JavaScript

JavaScript is the programming language traditionally used to add interactivity to web browsers. In the context of the video, JavaScript is explained as a browser-based language that could only be executed within a browser environment before Node.js enabled it to run on servers and outside of browsers.

💡V8 Engine

The V8 engine is Google Chrome’s JavaScript engine, responsible for executing JavaScript code. The video explains that Node.js leverages the V8 engine, allowing JavaScript to run outside of the browser environment, particularly on servers or local machines.

💡Runtime Environment

A runtime environment is where code is executed. The video clarifies that Node.js serves as a runtime environment for JavaScript, meaning it provides the necessary components for JavaScript to run outside of a browser by utilizing the V8 engine.

💡C++ Integration

Node.js integrates with C++, which allows low-level machine operations. In the video, this integration is highlighted as a significant advantage of Node.js, enabling JavaScript to handle tasks like file operations and network requests that were traditionally outside the capabilities of JavaScript.

💡Browser Engines

Browser engines, such as Chrome's V8 and Firefox's SpiderMonkey, are responsible for executing JavaScript in browsers. The video emphasizes how each browser has its own JavaScript engine, which affects how JavaScript runs differently across browsers.

💡Server-Side JavaScript

Server-side JavaScript refers to executing JavaScript on a server rather than a client’s browser. The video focuses on how Node.js allows JavaScript to function as a back-end language, enabling developers to build web servers using the language.

💡REPL (Read-Eval-Print Loop)

REPL is an interactive environment provided by Node.js where developers can type JavaScript code and see the results immediately. The video demonstrates how the REPL allows users to execute JavaScript directly from the command line, showcasing the interactive nature of Node.js.

💡Cross-Platform

Cross-platform refers to the ability to run on multiple operating systems. Node.js is described in the video as being cross-platform, which means it can be installed and used on various operating systems like Windows, macOS, and Linux.

💡Non-blocking I/O

Non-blocking I/O allows multiple input/output operations to happen concurrently without blocking the execution of other operations. Although not directly mentioned in detail in the video, this is an important concept behind why Node.js is efficient for handling multiple requests at once in server environments.

Highlights

Introduction to the tutorial series covering Node.js, creating web servers, MongoDB integration, and building REST apps.

Understanding what Node.js is: Node.js is not a framework or library, but a runtime environment for JavaScript.

JavaScript is traditionally a browser language, but Node.js allows it to run outside of the browser.

Explanation of JavaScript engines like Chrome's V8, Firefox's SpiderMonkey, and Safari's JavaScriptCore.

Chrome's V8 engine is the most popular JavaScript engine, enabling execution of JavaScript in the browser.

Node.js extracts the V8 engine and embeds it with C++ to allow JavaScript execution outside of the browser.

Node.js enables interaction with machine-level tasks like file handling and system storage using C++ functionalities.

Introduction of the concept that Node.js turns JavaScript into a language that can perform server-side tasks.

Demonstration of JavaScript execution within the browser using Chrome's V8 engine.

Explanation of how Node.js allows the same JavaScript code to execute in the terminal, outside of the browser.

Node.js REPL (Read-Eval-Print-Loop) enables interactive terminal-based execution of JavaScript code.

Demonstration of running JavaScript math operations and console logs within the Node.js environment in the terminal.

Conclusion: Node.js is a runtime environment that allows JavaScript to be executed outside of the browser, offering server-side capabilities.

Node.js uses Chrome's V8 engine for JavaScript execution and is integrated with C++ for enhanced machine-level capabilities.

Future videos will cover the installation and activation of Node.js on a machine, with approximately 32 videos in the series.

Transcripts

play00:00

एवरीवन वेलकम बैक एंड वेलकम तू अंदर

play00:02

एक्साइटिंग ट्यूटोरियल सीरीज डेट इसे नो

play00:04

जे एस सो इट्स ट्यूटोरियल सीरीज में हम

play00:07

पूरा नोट को कवर करने वाले नोटिस क्या

play00:09

होता है क्रिएटिंग वेब सर्वर से नोट चाहिए

play00:11

अलांग विथ मांगो डीबी क्रिएटिंग अरेस्ट

play00:13

एप्स सो एवरीथिंग एच एंड एवरीथिंग अबाउट

play00:16

नॉइस ओके सो इस वीडियो में हम पहले समझने

play00:19

वाले हैं नॉर्थईस्ट एक्चुअली में होता

play00:20

क्या है व्हाट इसे नॉट ओके सो नोट जस्ट

play00:23

क्या होता है क्या नोट जैसे फ्रेमवर्क है

play00:25

एक लाइब्रेरी है या फिर कुछ और ही है तो

play00:27

वो चीज हम इस वीडियो में समझने वाले हैं

play00:29

सो लेट्स स्टार्ट वीडियो सो लेट अस सी

play00:31

व्हाट इस नोट जेएस तो जब तुम नोट जीएस की

play00:34

बात करते हो तो उसमें सबसे पहला क्वेश्चन

play00:36

क्या आता है की यार नोट जीएस है क्या ठीक

play00:38

है सभी को थोड़ा-थोड़ा पता होगा इजिम डेट

play00:41

फॉर एग्जांपल्स बनाने के लिए होता है

play00:44

लेकिन नोट जिस एक्चुअली में है क्या हो इट

play00:46

वर्क्स तो वो हम इस वीडियो में देखने वाले

play00:47

हैं तो हम सब ने कम किया है करेक्ट सी नो

play00:51

व्हाट इस जावास्क्रिप्ट जावास्क्रिप्ट एक

play00:53

ब्राउज़र की लैंग्वेज होती है करेक्ट

play00:54

जिससे हम क्या करते हैं हम अपने ब्राउज़र

play00:56

को इंटरएक्टिव दे दिया तो जब मैं जावा पर

play01:00

कोड लिखता हूं विनय राइट समथिंग इन

play01:02

जावास्क्रिप्ट तो हम उसको एग्जीक्यूट कहां

play01:03

करते हैं हम उसको एग्जीक्यूट करते हैं

play01:05

हमारे ब्राउज़र के अंदर क्या तुम जावा

play01:08

स्क्रिप्ट को ब्राउज़र के बाहर एग्जीक्यूट

play01:10

कर सकते हो डी आंसर इस नो तो जो

play01:13

जावास्क्रिप्ट लैंग्वेज है ना वो सिर्फ और

play01:15

सिर्फ एक ब्राउज़र के अंदर ही एग्जीक्यूट

play01:18

हो सकती है ओके ऐसा क्यों बिकॉज हर

play01:21

ब्राउज़र के अंदर एक इंजन होता है जिसको

play01:23

हम बोलते हैं जावास्क्रिप्ट इंजन ओके तो

play01:26

बेसिकली जब तुम एक वेब ब्राउज़र को

play01:28

डाउनलोड करते हो ना तो उसका जो जावा

play01:30

स्क्रिप्ट इंजन है वो साथ ही में डाउनलोड

play01:31

होता है सो व्हेनेवर यू राइट अन

play01:34

जावास्क्रिप्ट कोड और तुम उसको ब्राउज़र

play01:35

पर रन करते हो तो ब्राउज़र क्या करता है

play01:38

इंजन को उसे करता है तो एग्जीक्यूटिव कोड

play01:41

लेकिन प्रॉब्लम क्या है की ये जो जावा

play01:43

स्क्रिप्ट इंजन है ना ये सिर्फ और सिर्फ

play01:45

ब्राउज़र के अंदर प्रेजेंट होता है

play01:47

लैंग्वेज को ब्राउज़र के बाहर एग्जीक्यूट

play01:50

करना वाज नॉट पॉसिबल ठीक है

play01:55

एंड हर एक ब्राउज़र का अपना एक इंजन होता

play01:57

है ठीक है फॉर एग्जांपल यू कैन सी डेट जो

play01:59

क्रोम है उसके पास होता है v8 इंजन जो

play02:02

फायरफॉक्स है वो स्पाइडर मंकी उसे करता है

play02:04

एंड जो हमारा सफारी है वो क्या उसे करता

play02:06

है एप्पल का जावास्क्रिप्ट इंजन उसे करता

play02:08

है तो ये बेसिकली क्या है ये इनके जावा

play02:10

सूट इंजन है ठीक है तो हर का अपना अपना

play02:12

जावा सूट इंजन है एंड डेट इस दी रीजन की

play02:16

जब तुम्हें javasunga कोल्ड लिखते हो वो

play02:18

थोड़ा सा डिफरेंटली बिहेव करता है क्रोम

play02:20

में फायरफॉक्स में एंड सफारी में नो इनमें

play02:23

से सबसे पॉप्युलर वाला कौन सा है डेट इस

play02:25

v8 इंजन ठीक है तो मोस्ट पॉप्युलर रीजन

play02:27

कौन सा है वेट जो हमें किस्म मिलता है

play02:29

क्रोमियम ब्राउज़र में मिलता है सो दिस वी

play02:32

इट इंजन इस डी मोस्ट पॉप्युलर वैन अब तुम

play02:34

पूछोगे वो तो ठीक है लेकिन हम ये चीज पढ़

play02:37

क्यों रहे हैं मतलब ये चीज तो हमें समझ ए

play02:38

गई डेट ठीक है जो हवा स्क्रिप्ट है वो

play02:40

सिर्फ ब्राउज़र के अंदर रन करती है बिकॉज

play02:42

उसमें जाओ इंजन होता है एंड मोस्ट

play02:44

पॉप्युलर कौन सा है अब एक साइंटिस्ट ने है

play02:47

जिसका नाम था यार ही इसे डिवेलप

play03:07

के एस ठीक है अब तुम पूछोगे डेट ठीक है बट

play03:12

इसका बेनिफिट क्या है लाइक व्हाट इसे डी

play03:13

बेनिफिट ऑफ एंबेडिंग वेट विथ डी सी प्लस

play03:15

प्लस हमें ये पता है जो v8 इंजन था वो

play03:18

क्रोम के अंदर था पहली बात हमने क्या किया

play03:20

हमने उसको एक्सट्रैक्ट कर लिया मतलब अब जो

play03:22

इंजन है वो क्रोम से बाहर ए चुका है एंड

play03:24

c++ जो की एक नेटिव लैंग्वेज है जो जिसके

play03:27

अंदर बहुत सारी मशीन फंक्शनैलिटीज हैं अब

play03:30

वो क्या कर सकते हैं वो जावास्क्रिप्ट को

play03:32

एग्जीक्यूट कर सकते हैं ब्राउज़र के बाहर

play03:34

तो इसका बेनिफिट क्या होगा डेट अब हम क्या

play03:36

कर सकते हैं जैसे लैंग्वेज को ब्राउज़र के

play03:39

बाहर भी एग्जीक्यूट कर सकते हैं तो मतलब

play03:41

की नोट जैसे आने के बाद जावास्क्रिप्ट

play03:44

ब्राउज़र के बाहर भी एग्जीक्यूट कर सकते

play03:46

हैं बाय बिकॉज इसके अंदर क्या है v8 इंजन

play03:49

है ओके

play03:51

नेटिव मशीन बिकॉज ऑफ सी प्लस प्लस तो की

play03:55

तुम जावास्क्रिप्ट के अंदर मशीन के साथ भी

play03:57

बात कर सकते हो फॉर एग्जांपल यू कैन तू

play03:58

फाइल हार्ड लिंक ठीक है तो अभी अपनी करंट

play04:01

मशीन की स्टोरेज देख सकते हो तो जितने भी

play04:03

टास्क सी प्लस प्लस जो मशीन लेवल पे कर

play04:05

सकती है ना लाइक फाइल हैंडलिंग एंड डी ऑल

play04:06

डेट तो वो स्क्रिप्ट भी अप कर सकती है

play04:08

बिकॉज ढाबा इंटरनल क्या है एक सी प्लस

play04:11

प्लस है तो उसे कर रही है आगे आई टोल्ड यू

play04:13

इन दी प्रीवियस स्लाइड की जो ये वीट इंजन

play04:15

है ना ये c++ के साथ एंबेड हो चुका है ठीक

play04:18

है तो जो भी हम जावा सूट कोड लिखेंगे तो

play04:21

वो एग्जीक्यूट कैसे होता है वेट इंजन को

play04:22

उसे करती है एग्जीक्यूट हो रहा है विच इस

play04:24

इनसाइड अन सी प्लस प्लस ओके एंड फाइनली अब

play04:28

हम इसमें वेबसाइट भी बना सकते हैं तो मैं

play04:30

जावा स्ट्रक लैंग्वेज को जावास्क्रिप्ट का

play04:32

सैंड टेक्स्ट जावा स्क्रैप के पावर को उसे

play04:34

करके मैं अपने वेब सर्वर बना सकता हूं एंड

play04:37

इस चीज को हम क्या बोलते हैं नोट के एस तो

play04:39

फाइनली हमें क्या पता लग रहा है नॉट जस्ट

play04:41

क्या है नोट जस्ट ना तो कोई फ्रेम वर्क है

play04:43

ना ही कोई लाइव दे रही है

play04:45

रन टाइम एनवायरनमेंट फॉर जावास्क्रिप्ट

play04:48

ठीक है

play04:50

एनवायरनमेंट है एक ऐसा एनवायरनमेंट जिसमें

play04:53

तुम जावा स्क्रिप्ट को एग्जीक्यूट कर सकते

play04:55

हो ठीक दिखाता हूं अभी मैं अपने ब्राउज़र

play04:59

के अंदर हूं

play05:00

मैं इसको जूमिन कर लेता हूं अगर मैं यहां

play05:04

पर लिखता हूं console.log लेट से मैंने

play05:07

यहां पर लिखा हेलो तो जैसे मैं इंटर

play05:08

करूंगा यू कैन सी डेट आई एम गेटिंग हेलो

play05:10

ठीक है तो ये जो जावा स्क्रिप्ट का कोड था

play05:12

जो मैंने जावा सिर्फ लिखा या फिर अगर मैं

play05:15

यहां पे लिखता हूं तू प्लस थ्री आई एम

play05:16

गेटिंग फाइव तो ये कैसे एग्जीक्यूट हो रहा

play05:18

है ये v8 इंजन जो आवास आपका इंजन है उसको

play05:21

उसे करके ये चीज रन कर रही हैं करेक्ट

play05:23

लेकिन अगर मैं अपनी मशीन पे जाता हूं ठीक

play05:26

है एंड आय राइट दिस सिमिलर कोड अगर मैं

play05:29

इसको कॉपी करके यहां पे पेस्ट करता हूं

play05:30

क्या चलेगा ओबवियसली नहीं बिकॉज मैंने

play05:33

क्या बताया था जो जावा स्क्रिप्ट है उसको

play05:35

एग्जीक्यूट करने के लिए क्या चाहिए होता

play05:36

है इंजन लेकिन मेरे मशीन इंस्टॉल है सो

play05:41

व्हाट आई कैन डू आय कैन से नोट एंड इससे

play05:43

क्या होगा नोट का रप्पल और इंटरएक्टिव

play05:45

टर्मिनल ओपन हो जाएगा अगर मैं यहां पर यू

play05:49

कैन सी आय ऍम गेटिंग हेलो ठीक है अगर मैं

play05:52

यहां पर अकाउंट तू प्लस फाइव यू कैन सी

play05:54

डेट आई एम 37 ठीक है तो मैथमेटिकल ऑपरेटर

play05:57

बिल्कुल सही कम कर रहे हैं आई कैन लाइक से

play05:59

कम

play06:01

sol.log हेलो फ्रॉम जेएस ठीक है सो यू कैन

play06:06

सी डेट नोट को उसे करके जैसे मैंने अपने

play06:08

नोट कमांड उसे की मेरा नोट्स एक्टिव वाल्व

play06:11

अब मैं क्या कर का रहा हूं मैं से जो यहां

play06:13

पर कम कर का रहा था जो जावा स्क्रिप्ट का

play06:15

कोड मैं यहां पे एग्जीक्यूट कर का रहा था

play06:17

उसे कोड को मैं एग्जीक्यूट कर का रहा हूं

play06:19

मेरे टर्मिनल के अंदर मतलब मेरे ब्राउज़र

play06:22

के बाहर एंड ये क्यों पॉसिबल है बिकॉज ऑफ

play06:24

दिस नोट अगर अब तुमसे कोई पूछेगा नोट जिस

play06:26

क्या होती है सो व्हाट इसे डी आंसर डेट

play06:28

नोट जीएस इस अन टाइम एनवायरनमेंट फॉर

play06:30

जावास्क्रिप्ट ओके अगर तुम वेबसाइट पर भी

play06:33

चाहते हो डेट इस नोट के एस डॉट ऑर्ग सो इफ

play06:36

यू गो तू दिस वेबसाइट यू कैन सी डेट ओपन

play06:38

सोर्स क्रॉस प्लेटफार्म

play06:48

विद नोट यस एंड ऑल बिकॉज नो ड्रेस कुछ

play06:52

नहीं है नो ड्रेस जैसे

play07:08

उसका लिंक मैं डिस्क्रिप्शन में ड्रॉप कर

play07:10

दूंगा देयर अप्रॉक्स 32 वीडियो तो अगर तुम

play07:13

उनको देख लेते हो यू आर गुड तू गो तो

play07:15

तुम्हें स्क्रिप्ट आणि चाहिए बिफोर

play07:17

स्टार्टिंग विद नोट जीएस बिकॉज हम सारी

play07:19

लैंग्वेज हम सारा कोड ज्यादा स्क्रिप्ट

play07:21

में ही लिखेंगे सिंपल जावास्क्रिप्ट में

play07:23

नोट के इस जस्ट अन अनटाइम एनवायरनमेंट

play07:26

सो आय होप डेट तुम्हें एक क्लेरिटी मिली

play07:29

होगी तो मैं एक इंट्रोडक्शन मिला होगा डेट

play07:31

नॉट जस्ट होता क्या व्हाट एक्जेक्टली इसे

play07:33

नॉट जस्ट वीडियो में विल सी डेट हम इसको

play07:36

इंस्टॉल कैसे कर सकते हैं हम इसको

play07:37

एक्टिवेट कैसे कर सकते हैं हमारी मशीन में

play07:39

सो थॉट्स ऑल दिस वीडियो मिलते हैं आपको

play07:41

नेक्स्ट वीडियो में अंटील दें बाय

Rate This

5.0 / 5 (0 votes)

Ähnliche Tags
Node.js BasicsJavaScript RuntimeV8 EngineWeb ServersTutorial SeriesBeginner FriendlyJavaScript ExecutionC++ IntegrationBackend DevelopmentCross-Platform
Benötigen Sie eine Zusammenfassung auf Englisch?