title
Node.js Tutorial for Beginners: Learn Node in 1 Hour
description
Node.js Tutorial for Beginners: Learn Node in 1 Hour
🔥 Get the complete Node course: http://bit.ly/2NfkpOC
👁 Subscribe for more tutorials like this: https://goo.gl/6PYaGF
⭐️ Want to learn more from me? Check out these links:
Courses: https://codewithmosh.com
Twitter: https://twitter.com/moshhamedani
Facebook: https://www.facebook.com/programmingwithmosh/
Blog: https://programmingwithmosh.com
TABLE OF CONTENT:
00:00 What is Node
03:01 Node Architecture
06:04 How Node Works
10:29 Installing Node
13:01 Your First Node Program
15:22 Node Module System
15:52 Global Object
19:14 Modules
22:51 Creating a Module
27:35 Loading a Module
32:59 Module Wrapper Function
39:53 Path Module
44:03 OS Module
48:22 File System Module
53:14 Events Module
59:33 Event Arguments
01:02:43 Extending EventEmitter
01:10:46 HTTP Module
detail
{'title': 'Node.js Tutorial for Beginners: Learn Node in 1 Hour', 'heatmap': [{'end': 894.933, 'start': 796.901, 'weight': 0.853}, {'end': 3157.819, 'start': 3098.79, 'weight': 1}], 'summary': 'Tutorial covers node.js as an ideal choice for scalable backend services, fundamentals, working with modules, built-in modules, asynchronous methods, events and event handling, event emitter, logging, and http module in node. it emphasizes the usage by major companies like paypal, uber, netflix, and walmart and provides practical examples and demonstrations for hands-on learning.', 'chapters': [{'end': 566.037, 'segs': [{'end': 29.943, 'src': 'embed', 'start': 2.238, 'weight': 2, 'content': [{'end': 11.54, 'text': 'Node.js or Node is an open source and cross-platform runtime environment for executing JavaScript code outside of a browser.', 'start': 2.238, 'duration': 9.302}, {'end': 19.781, 'text': 'Quite often we use Node to build backend services, also called APIs or application programming interfaces.', 'start': 12.26, 'duration': 7.521}, {'end': 29.943, 'text': 'These are the services that power our client applications, like a web app running inside of a web browser or a mobile app running on a mobile device.', 'start': 20.421, 'duration': 9.522}], 'summary': 'Node.js is a cross-platform runtime for executing javascript code outside a browser, commonly used to build backend services for client applications.', 'duration': 27.705, 'max_score': 2.238, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt42238.jpg'}, {'end': 105.919, 'src': 'embed', 'start': 81.82, 'weight': 0, 'content': [{'end': 88.245, 'text': "It's used in production by large companies such as PayPal, Uber, Netflix, Walmart, and so on.", 'start': 81.82, 'duration': 6.425}, {'end': 94.23, 'text': 'In fact, at PayPal, they rebuilt one of their Java and Spring-based applications using Node.', 'start': 88.785, 'duration': 5.445}, {'end': 105.919, 'text': 'And they found that the Node application was built twice as fast with fewer people, in 33% fewer lines of code, and 40% fewer files.', 'start': 94.97, 'duration': 10.949}], 'summary': 'Node application built twice as fast at paypal with 33% fewer lines of code.', 'duration': 24.099, 'max_score': 81.82, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt481820.jpg'}, {'end': 167.967, 'src': 'embed', 'start': 128.94, 'weight': 1, 'content': [{'end': 135.567, 'text': 'you can reuse your JavaScript skills and transition to a full stack developer and get a better job with better pay.', 'start': 128.94, 'duration': 6.627}, {'end': 138.21, 'text': "You don't have to learn a new programming language.", 'start': 136.148, 'duration': 2.062}, {'end': 146.656, 'text': 'Also, because you can use JavaScript both on the front end and on the back end, your source code will be cleaner and more consistent.', 'start': 139.011, 'duration': 7.645}, {'end': 151.599, 'text': 'So you will use the same naming conventions, the same tools, and the same best practices.', 'start': 147.136, 'duration': 4.463}, {'end': 159.545, 'text': 'And finally, another reason for using Node is that it has the largest ecosystem of open source libraries available to you.', 'start': 152.34, 'duration': 7.205}, {'end': 164.746, 'text': 'So, for pretty much any features or building blocks you want to add to your application,', 'start': 160.265, 'duration': 4.481}, {'end': 167.967, 'text': 'there is some free open source library out there that you can use.', 'start': 164.746, 'duration': 3.221}], 'summary': 'Transition to full stack developer with javascript, no new language needed. node offers cleaner, consistent code and largest ecosystem of open source libraries.', 'duration': 39.027, 'max_score': 128.94, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt4128940.jpg'}, {'end': 293.849, 'src': 'embed', 'start': 268.086, 'weight': 4, 'content': [{'end': 272.551, 'text': 'So similar to a browser, Node is a runtime environment for JavaScript code.', 'start': 268.086, 'duration': 4.465}, {'end': 277.616, 'text': 'It contains a JavaScript engine that can execute our JavaScript code,', 'start': 273.131, 'duration': 4.485}, {'end': 282.801, 'text': 'but it also has certain objects that provide an environment for our JavaScript code.', 'start': 277.616, 'duration': 5.185}, {'end': 286.965, 'text': 'But these objects are different from the environment objects we have in browsers.', 'start': 283.402, 'duration': 3.563}, {'end': 289.546, 'text': "For example, we don't have the document object.", 'start': 287.485, 'duration': 2.061}, {'end': 293.849, 'text': 'Instead, we have other objects that give us more interesting capabilities.', 'start': 290.007, 'duration': 3.842}], 'summary': 'Node is a javascript runtime environment with unique environment objects.', 'duration': 25.763, 'max_score': 268.086, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt4268086.jpg'}, {'end': 394.028, 'src': 'embed', 'start': 366.656, 'weight': 5, 'content': [{'end': 374.659, 'text': 'So earlier I mentioned that Node applications are highly scalable, and this is because of the non-blocking or asynchronous nature of Node.', 'start': 366.656, 'duration': 8.003}, {'end': 378.16, 'text': 'What do I mean by asynchronous? Let me give you a metaphor.', 'start': 375.239, 'duration': 2.921}, {'end': 380.181, 'text': 'Imagine you go to a restaurant.', 'start': 378.881, 'duration': 1.3}, {'end': 384.383, 'text': 'A waiter comes to your table, takes your order, and gives it to the kitchen.', 'start': 380.861, 'duration': 3.522}, {'end': 394.028, 'text': 'then they move on to serve another table while the chef is preparing your meal, so the same person can serve many different tables.', 'start': 385.163, 'duration': 8.865}], 'summary': 'Node applications are scalable due to non-blocking nature, like a waiter serving multiple tables.', 'duration': 27.372, 'max_score': 366.656, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt4366656.jpg'}], 'start': 2.238, 'title': 'Node.js for scalable backend services', 'summary': 'Introduces node.js as an ideal choice for building highly scalable, data-intensive, and real-time backend services, highlighting its usage by major companies like paypal, uber, netflix, and walmart to achieve significant performance improvements and reduced development effort.', 'chapters': [{'end': 151.599, 'start': 2.238, 'title': 'Node.js for scalable backend services', 'summary': 'Introduces node.js as an ideal choice for building highly scalable, data-intensive, and real-time backend services, highlighting its usage by major companies like paypal, uber, netflix, and walmart to achieve significant performance improvements and reduced development effort, making it a valuable tool for both prototyping and production.', 'duration': 149.361, 'highlights': ['Node.js is used in production by large companies like PayPal, Uber, Netflix, and Walmart, with PayPal experiencing significant performance improvements after rebuilding an application with Node, achieving twice the speed with fewer resources, 33% fewer lines of code, and 40% fewer files, and doubling the number of requests served per second while decreasing the average response time by 35%. Highlights the significant performance improvements experienced by PayPal after rebuilding an application with Node.js, including achieving twice the speed with fewer resources, 33% fewer lines of code, and 40% fewer files, and doubling the number of requests served per second while decreasing the average response time by 35%.', 'Node.js allows for the reuse of JavaScript skills, enabling front-end developers to transition to full stack development and benefit from better job opportunities and pay without learning a new programming language. Emphasizes the benefit of using Node.js for front-end developers to transition to full stack development by reusing JavaScript skills, leading to better job opportunities and pay without the need to learn a new programming language.', 'Node.js enables the use of JavaScript on both the front end and back end, leading to cleaner and more consistent source code through unified naming conventions, tools, and best practices. Underlines the advantage of using Node.js to maintain cleaner and more consistent source code by utilizing JavaScript on both the front end and back end, resulting in unified naming conventions, tools, and best practices.']}, {'end': 566.037, 'start': 152.34, 'title': 'Node.js: runtime environment & asynchronous architecture', 'summary': 'Discusses the reasons for using node.js, its architecture as a runtime environment, and the asynchronous nature of node applications, emphasizing its non-blocking architecture and its efficiency in handling concurrent requests.', 'duration': 413.697, 'highlights': ['Node.js provides the largest ecosystem of open source libraries, allowing for the addition of free open source libraries to applications, reducing the need to build building blocks from scratch. Node.js offers the largest ecosystem of open source libraries, enabling the addition of various features and building blocks to applications, reducing the necessity to create them from scratch.', 'Node.js is a runtime environment for JavaScript code, similar to browsers, but with different environment objects and additional modules, allowing capabilities such as file system operations and network handling. Node.js functions as a runtime environment for JavaScript code, offering different environment objects and additional modules compared to browsers, providing capabilities like file system operations and network handling.', 'Node.js applications are highly scalable due to their non-blocking or asynchronous architecture, allowing a single thread to handle multiple requests efficiently. Node.js applications are highly scalable due to their non-blocking or asynchronous architecture, enabling a single thread to efficiently handle multiple requests.']}], 'duration': 563.799, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt42238.jpg', 'highlights': ['Node.js is used in production by large companies like PayPal, Uber, Netflix, and Walmart, with PayPal experiencing significant performance improvements after rebuilding an application with Node, achieving twice the speed with fewer resources, 33% fewer lines of code, and 40% fewer files, and doubling the number of requests served per second while decreasing the average response time by 35%.', 'Node.js allows for the reuse of JavaScript skills, enabling front-end developers to transition to full stack development and benefit from better job opportunities and pay without learning a new programming language.', 'Node.js enables the use of JavaScript on both the front end and back end, leading to cleaner and more consistent source code through unified naming conventions, tools, and best practices.', 'Node.js provides the largest ecosystem of open source libraries, allowing for the addition of free open source libraries to applications, reducing the need to build building blocks from scratch.', 'Node.js is a runtime environment for JavaScript code, similar to browsers, but with different environment objects and additional modules, allowing capabilities such as file system operations and network handling.', 'Node.js applications are highly scalable due to their non-blocking or asynchronous architecture, allowing a single thread to handle multiple requests efficiently.']}, {'end': 1621.789, 'segs': [{'end': 614.427, 'src': 'embed', 'start': 566.618, 'weight': 0, 'content': [{'end': 574.082, 'text': 'This kind of architecture makes Node ideal for building applications that include a lot of disk or network access.', 'start': 566.618, 'duration': 7.464}, {'end': 578.625, 'text': 'We can serve more clients without the need to throw in more hardware.', 'start': 574.663, 'duration': 3.962}, {'end': 581.826, 'text': "And that's why node applications are highly scalable.", 'start': 578.965, 'duration': 2.861}, {'end': 591.331, 'text': 'In contrast, node should not be used for CPU intensive applications like a video encoding or an image manipulation service.', 'start': 582.487, 'duration': 8.844}, {'end': 600.876, 'text': 'In this kind of applications, we have a lot of calculations that should be done by CPU and few operations that touch the file system or the network.', 'start': 592.051, 'duration': 8.825}, {'end': 609.763, 'text': 'since node applications are single threaded, when performing the calculations to serve one client, other clients have to wait,', 'start': 601.696, 'duration': 8.067}, {'end': 614.427, 'text': "and that's why node should not be used for cpu intensive applications.", 'start': 609.763, 'duration': 4.664}], 'summary': "Node is ideal for disk or network-intensive apps, enabling more clients without additional hardware. however, it's not suitable for cpu-intensive tasks due to its single-threaded nature.", 'duration': 47.809, 'max_score': 566.618, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt4566618.jpg'}, {'end': 721.505, 'src': 'embed', 'start': 692.245, 'weight': 2, 'content': [{'end': 696.028, 'text': 'so i want you to install the latest stable version.', 'start': 692.245, 'duration': 3.783}, {'end': 703.112, 'text': "also take into account that in the future, when you're watching this video, chances are the latest stable version might be newer.", 'start': 696.028, 'duration': 7.084}, {'end': 710.177, 'text': "if you're worried that this course is going to get outdated, don't worry, because in this course we're going to focus on the fundamentals.", 'start': 703.112, 'duration': 7.065}, {'end': 712.759, 'text': "so i'm going to work with the core modules of node.", 'start': 710.177, 'duration': 2.582}, {'end': 714.74, 'text': 'these core modules are stable.', 'start': 712.759, 'duration': 1.981}, {'end': 716.521, 'text': 'they have been there for a long time.', 'start': 714.74, 'duration': 1.781}, {'end': 721.505, 'text': "so the code that we're going to write in this course will continue to work with the future versions of node.", 'start': 716.521, 'duration': 4.984}], 'summary': 'Focus on fundamentals with stable core modules for future-proof code.', 'duration': 29.26, 'max_score': 692.245, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt4692245.jpg'}, {'end': 796.901, 'src': 'embed', 'start': 765.391, 'weight': 3, 'content': [{'end': 770.835, 'text': "So now, back in the terminal, let's run node dash dash version one more time.", 'start': 765.391, 'duration': 5.444}, {'end': 773.798, 'text': 'You can see I upgraded my node to version 8.9.1.', 'start': 771.796, 'duration': 2.002}, {'end': 778.882, 'text': "Next, we're going to build our first node application.", 'start': 773.798, 'duration': 5.084}, {'end': 791.298, 'text': "all right now we're ready to build our first node application, so i'm going to create a new folder.", 'start': 784.474, 'duration': 6.824}, {'end': 793.959, 'text': 'call it first app.', 'start': 791.298, 'duration': 2.661}, {'end': 796.901, 'text': "let's go to this folder.", 'start': 793.959, 'duration': 2.942}], 'summary': 'Upgraded node to version 8.9.1 and ready to build first node application.', 'duration': 31.51, 'max_score': 765.391, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt4765391.jpg'}, {'end': 894.933, 'src': 'heatmap', 'start': 796.901, 'weight': 0.853, 'content': [{'end': 805.025, 'text': "now i'm going to open this folder inside of visual studio code, which is my preferred code editor, so code period.", 'start': 796.901, 'duration': 8.124}, {'end': 810.231, 'text': 'So this is Visual Studio Code or VS Code.', 'start': 807.97, 'duration': 2.261}, {'end': 814.492, 'text': "It's a free, powerful editor, but you can use any editors that you prefer.", 'start': 810.731, 'duration': 3.761}, {'end': 818.374, 'text': 'You can use Sublime, you can use Atom, or any other editors.', 'start': 814.873, 'duration': 3.501}, {'end': 824.296, 'text': "So here in this folder, I'm going to add a new file, app.js.", 'start': 819.154, 'duration': 5.142}, {'end': 830.458, 'text': 'In this file, we can write regular JavaScript, just like the JavaScript that we write for the browsers.', 'start': 825.477, 'duration': 4.981}, {'end': 841.528, 'text': "So I'm going to define a function, say hello, that takes a parameter name, simply logs a message on the console.", 'start': 831.139, 'duration': 10.389}, {'end': 850.456, 'text': 'so hello plus name, and then we can call this function like this mosh.', 'start': 841.528, 'duration': 8.928}, {'end': 858.624, 'text': "now, to execute this code, we're going to go back to the terminal and run node and pass the name of the file as an argument.", 'start': 850.456, 'duration': 8.168}, {'end': 859.144, 'text': 'so app.js.', 'start': 858.624, 'duration': 0.52}, {'end': 864.468, 'text': 'so node, as i told you before, is a c plus plus program.', 'start': 860.505, 'duration': 3.963}, {'end': 868.11, 'text': "it includes chrome's v8 javascript engine.", 'start': 864.468, 'duration': 3.642}, {'end': 874.854, 'text': "so this app.js file that we're going to pass to node, node is going to give it to v8 for execution.", 'start': 868.11, 'duration': 6.744}, {'end': 877.876, 'text': 'so you can see we got hello mosh on the console.', 'start': 874.854, 'duration': 3.022}, {'end': 879.257, 'text': 'now let me show you something.', 'start': 877.876, 'duration': 1.381}, {'end': 888.209, 'text': "so back in vs code, I'm going to temporarily comment out this line and do a console.log of window.", 'start': 879.257, 'duration': 8.952}, {'end': 890.11, 'text': "Let's see what happens.", 'start': 889.35, 'duration': 0.76}, {'end': 894.933, 'text': "So back in the terminal, let's run node app.js.", 'start': 890.691, 'duration': 4.242}], 'summary': "Using visual studio code, created app.js file, executed code using node, resulting in 'hello mosh' on console.", 'duration': 98.032, 'max_score': 796.901, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt4796901.jpg'}, {'end': 877.876, 'src': 'embed', 'start': 850.456, 'weight': 4, 'content': [{'end': 858.624, 'text': "now, to execute this code, we're going to go back to the terminal and run node and pass the name of the file as an argument.", 'start': 850.456, 'duration': 8.168}, {'end': 859.144, 'text': 'so app.js.', 'start': 858.624, 'duration': 0.52}, {'end': 864.468, 'text': 'so node, as i told you before, is a c plus plus program.', 'start': 860.505, 'duration': 3.963}, {'end': 868.11, 'text': "it includes chrome's v8 javascript engine.", 'start': 864.468, 'duration': 3.642}, {'end': 874.854, 'text': "so this app.js file that we're going to pass to node, node is going to give it to v8 for execution.", 'start': 868.11, 'duration': 6.744}, {'end': 877.876, 'text': 'so you can see we got hello mosh on the console.', 'start': 874.854, 'duration': 3.022}], 'summary': "Executing app.js with node runs chrome's v8 engine, displaying 'hello mosh' on console.", 'duration': 27.42, 'max_score': 850.456, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt4850456.jpg'}, {'end': 1281.666, 'src': 'embed', 'start': 1248.598, 'weight': 8, 'content': [{'end': 1253.439, 'text': 'The variables and functions we define in that file or that module are scoped to that file.', 'start': 1248.598, 'duration': 4.841}, {'end': 1257.479, 'text': 'In object-oriented programming terms, we say they are private.', 'start': 1254.079, 'duration': 3.4}, {'end': 1261.26, 'text': 'They are not available outside that container, outside that module.', 'start': 1257.92, 'duration': 3.34}, {'end': 1269.762, 'text': 'If you want to use a variable or a function defined in a module outside that module, you need to explicitly export it and make it public.', 'start': 1261.82, 'duration': 7.942}, {'end': 1272.063, 'text': "And we're going to look at that in the next lecture.", 'start': 1270.242, 'duration': 1.821}, {'end': 1281.666, 'text': 'So what I want you to take away from this lecture is that every node application has at least one file or one module which we call the main module.', 'start': 1272.683, 'duration': 8.983}], 'summary': 'Variables and functions in a module are private, need to be explicitly exported to be public.', 'duration': 33.068, 'max_score': 1248.598, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt41248598.jpg'}, {'end': 1430.046, 'src': 'embed', 'start': 1349.355, 'weight': 5, 'content': [{'end': 1353.458, 'text': 'As we go through this section, you will gradually become familiar with these properties.', 'start': 1349.355, 'duration': 4.103}, {'end': 1362.508, 'text': 'So in Node, every file is a module, and the variables and functions defined in that file are scoped to that module.', 'start': 1355.02, 'duration': 7.488}, {'end': 1365.051, 'text': "They're not available outside of that module.", 'start': 1362.748, 'duration': 2.303}, {'end': 1369.135, 'text': "In the next lecture, you're going to learn how to create and load a module.", 'start': 1365.631, 'duration': 3.504}, {'end': 1377.601, 'text': "Alright, now let's add a new module to this application.", 'start': 1374.599, 'duration': 3.002}, {'end': 1384.127, 'text': "So I'm gonna add a new file logger.js.", 'start': 1378.282, 'duration': 5.845}, {'end': 1394.135, 'text': "Let's imagine we're going to create a module for login messages and we're going to reuse this module in various parts of this application or potentially in other applications.", 'start': 1384.127, 'duration': 10.008}, {'end': 1395.656, 'text': 'so logger.js.', 'start': 1394.135, 'duration': 1.521}, {'end': 1404.472, 'text': "Now, in this module, let's imagine that we're going to use one of those remote logging services for logging our messages.", 'start': 1397.287, 'duration': 7.185}, {'end': 1408.594, 'text': 'So there are websites out there that provide logging as a service.', 'start': 1404.932, 'duration': 3.662}, {'end': 1415.239, 'text': 'They give us a URL and we can send an HTTP request to that URL to log messages in the cloud.', 'start': 1409.075, 'duration': 6.164}, {'end': 1418.401, 'text': "So here I'm going to declare a variable.", 'start': 1415.859, 'duration': 2.542}, {'end': 1427.123, 'text': 'like URL and set it to something like this HTTP mylogger.io.', 'start': 1419.778, 'duration': 7.345}, {'end': 1428.364, 'text': 'slash log.', 'start': 1427.123, 'duration': 1.241}, {'end': 1430.046, 'text': "and of course I'm making this up.", 'start': 1428.364, 'duration': 1.682}], 'summary': 'Introduction to creating and using modules in node.js, including defining scoped variables and functions, and utilizing remote logging services.', 'duration': 80.691, 'max_score': 1349.355, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt41349355.jpg'}, {'end': 1597.315, 'src': 'embed', 'start': 1571.844, 'weight': 9, 'content': [{'end': 1581.028, 'text': "Okay, now, in this case, we don't need to export this URL variable, because this is purely implementation detail.", 'start': 1571.844, 'duration': 9.184}, {'end': 1586.35, 'text': 'So, in real world applications, every module might have several variables and functions.', 'start': 1581.028, 'duration': 5.322}, {'end': 1593.533, 'text': 'We only want to export a subset of these members to the outside because we want to keep this module easy to use.', 'start': 1586.35, 'duration': 7.183}, {'end': 1594.494, 'text': 'Let me give you a metaphor.', 'start': 1593.533, 'duration': 0.961}, {'end': 1597.315, 'text': 'Think of a DVD player.', 'start': 1595.354, 'duration': 1.961}], 'summary': 'Modules should export a subset of their members to keep them easy to use.', 'duration': 25.471, 'max_score': 1571.844, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt41571844.jpg'}], 'start': 566.618, 'title': 'Node.js fundamentals', 'summary': 'Delves into node architecture, installation, and basics, emphasizing suitability for data-intensive and real-time applications, scalability, and limitations. it covers upgrading to version 8.9.1, modular system, and creating a reusable logger module with an emphasis on modularity and ease of use.', 'chapters': [{'end': 763.969, 'start': 566.618, 'title': 'Node architecture and installation', 'summary': 'Explains the architecture of node applications, highlighting its suitability for data-intensive and real-time applications, its scalability for handling more clients without additional hardware, and its limitations in cpu-intensive tasks. it also provides instructions for installing the latest stable version of node and emphasizes focusing on the fundamentals of core modules.', 'duration': 197.351, 'highlights': ['Node applications are highly scalable, allowing for serving more clients without the need for additional hardware, making it ideal for building data-intensive and real-time applications.', 'Node should not be used for CPU-intensive applications like video encoding or image manipulation services due to its single-threaded nature, causing other clients to wait during CPU calculations.', 'Instructions for installing the latest stable version of Node, emphasizing the importance of focusing on the fundamentals of core modules for continued compatibility with future versions.']}, {'end': 1377.601, 'start': 765.391, 'title': 'Node.js basics', 'summary': 'Covers the basics of node.js, including upgrading to version 8.9.1, creating and executing a node application, and understanding the modular system in node. it also introduces the concept of modules, their scope, and the process of exporting variables and functions.', 'duration': 612.21, 'highlights': ['Node.js upgrade to version 8.9.1 The speaker upgrades Node to version 8.9.1, demonstrating the process of upgrading and indicating the new version.', 'Creating and executing a Node application The process of creating a new folder, adding a JavaScript file (app.js), defining a function, and executing the code using Node, with a demonstration of the console output.', "Introduction to Node's modular system and module scope Explanation of the modular system in Node, defining modules as private containers and highlighting the need to export variables and functions to make them public."]}, {'end': 1621.789, 'start': 1378.282, 'title': 'Creating reusable logger module', 'summary': 'Discusses creating a module for logging messages, using a remote logging service, and exporting specific variables and functions for modularity, emphasizing the need to keep modules easy to use and only exporting necessary members.', 'duration': 243.507, 'highlights': ['Creating a module for logging messages and reusing it in various parts of the application. Emphasizing the reusability of the logger module.', 'Using a remote logging service to log messages in the cloud. Describing the implementation of sending HTTP requests to a remote logging service.', 'Exporting specific variables and functions to make them accessible from outside the module. Explaining the concept of making certain members of the module public for external use.', 'Emphasizing the need to export a subset of members to keep the module easy to use. Stressing the importance of exporting only necessary members for simplicity and ease of use.']}], 'duration': 1055.171, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt4566618.jpg', 'highlights': ['Node applications are highly scalable, ideal for data-intensive and real-time applications.', 'Node should not be used for CPU-intensive applications due to its single-threaded nature.', 'Instructions for installing the latest stable version of Node, focusing on core modules compatibility.', 'Upgrading Node to version 8.9.1, demonstrating the process and indicating the new version.', 'Creating and executing a Node application, demonstrating the process and console output.', "Introduction to Node's modular system and module scope, defining modules as private containers.", 'Creating a module for logging messages, emphasizing reusability.', 'Using a remote logging service to log messages in the cloud, implementing HTTP requests.', 'Exporting specific variables and functions to make them accessible from outside the module.', 'Emphasizing the need to export a subset of members to keep the module easy to use.']}, {'end': 2356.996, 'segs': [{'end': 1818.025, 'src': 'embed', 'start': 1792.956, 'weight': 0, 'content': [{'end': 1800.202, 'text': 'When we define a module, we export one or more members, and then to load the module, we use the require function.', 'start': 1792.956, 'duration': 7.246}, {'end': 1807.882, 'text': 'Now, in the recent versions of JavaScript, we have the ability to define constants.', 'start': 1801.38, 'duration': 6.502}, {'end': 1818.025, 'text': "So as a best practice, when loading a module using the required function, it's better to store the result in a constant, like this.", 'start': 1808.502, 'duration': 9.523}], 'summary': 'Javascript modules now support constants for better code organization.', 'duration': 25.069, 'max_score': 1792.956, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt41792956.jpg'}, {'end': 1928.017, 'src': 'embed', 'start': 1875.325, 'weight': 2, 'content': [{'end': 1883.451, 'text': 'So if you run jshint app.js, we get this error attempting to overwrite logger, which is a constant.', 'start': 1875.325, 'duration': 8.126}, {'end': 1888.995, 'text': 'So with tools like jshint, we can scan all our JavaScript code for errors like that.', 'start': 1884.011, 'duration': 4.984}, {'end': 1893.558, 'text': "So that's the benefit of using a constant as opposed to a variable here.", 'start': 1889.656, 'duration': 3.902}, {'end': 1900.484, 'text': "If you accidentally reset this object, then we're going to get an error at compile time instead of at runtime.", 'start': 1894.299, 'duration': 6.185}, {'end': 1905.361, 'text': 'Okay, one last thing before we finish this lecture.', 'start': 1900.804, 'duration': 4.557}, {'end': 1912.746, 'text': 'sometimes, instead of exporting an object from a module, you may want to export only a single function.', 'start': 1905.361, 'duration': 7.385}, {'end': 1919.992, 'text': "for example, here in our logger module, we don't necessarily need an object because we have a single method.", 'start': 1912.746, 'duration': 7.246}, {'end': 1928.017, 'text': 'an object would be useful if we had multiple methods or properties here, But in this case, instead of exporting an object,', 'start': 1919.992, 'duration': 8.025}], 'summary': 'Using jshint to scan javascript code for errors, benefits of using a constant, and exporting a single function from a module.', 'duration': 52.692, 'max_score': 1875.325, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt41875325.jpg'}, {'end': 1994.95, 'src': 'embed', 'start': 1959.963, 'weight': 4, 'content': [{'end': 1965.024, 'text': "so i'm going to press f2 to rename this log like this.", 'start': 1959.963, 'duration': 5.061}, {'end': 1973.045, 'text': "now, back in terminal, let's run node app.js and we get the same result.", 'start': 1965.024, 'duration': 8.021}, {'end': 1977.406, 'text': 'so in your modules you can export a single function or an object.', 'start': 1973.045, 'duration': 4.361}, {'end': 1988.925, 'text': 'So now you know the variables and functions we define in a module are scoped to that module.', 'start': 1983.14, 'duration': 5.785}, {'end': 1991.587, 'text': "They're private and not visible from the outside.", 'start': 1989.165, 'duration': 2.422}, {'end': 1994.95, 'text': 'But you might be wondering how Node does this.', 'start': 1992.248, 'duration': 2.702}], 'summary': 'Demonstrates renaming log, exporting functions, and scoping in node.js modules.', 'duration': 34.987, 'max_score': 1959.963, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt41959963.jpg'}, {'end': 2126.959, 'src': 'embed', 'start': 2101.89, 'weight': 5, 'content': [{'end': 2107.174, 'text': 'What I want you to take away here is that Node does not execute our code directly.', 'start': 2101.89, 'duration': 5.284}, {'end': 2113.076, 'text': 'It always wraps the code inside each module in something like this, inside of a function.', 'start': 2107.774, 'duration': 5.302}, {'end': 2115.856, 'text': 'Now look at these arguments to this function.', 'start': 2113.756, 'duration': 2.1}, {'end': 2118.577, 'text': 'So you have seen the require function.', 'start': 2116.616, 'duration': 1.961}, {'end': 2124.559, 'text': "I told you that this require function appears to be global, but actually it's not global.", 'start': 2118.597, 'duration': 5.962}, {'end': 2126.959, 'text': "In fact, it's local to each module.", 'start': 2124.959, 'duration': 2}], 'summary': 'Node wraps code in functions, require function is local to each module.', 'duration': 25.069, 'max_score': 2101.89, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt42101890.jpg'}, {'end': 2294.373, 'src': 'embed', 'start': 2263.857, 'weight': 6, 'content': [{'end': 2266.738, 'text': 'hi guys, thank you for watching my node tutorial.', 'start': 2263.857, 'duration': 2.881}, {'end': 2272.041, 'text': 'i wanted to let you know that this tutorial is the first hour of my complete node course,', 'start': 2266.738, 'duration': 5.303}, {'end': 2276.923, 'text': 'where you will learn how to build a real restful api using node,', 'start': 2272.041, 'duration': 4.882}, {'end': 2283.686, 'text': 'express and mongodb all of that recorded with the latest version of node and modern javascript,', 'start': 2276.923, 'duration': 6.763}, {'end': 2287.668, 'text': 'so you will learn the new and modern ways of building applications with node.', 'start': 2283.686, 'duration': 3.982}, {'end': 2294.373, 'text': 'Unlike other courses that only show you simple, dummy examples like how to build a to-do app,', 'start': 2288.428, 'duration': 5.945}], 'summary': 'Learn to build a real restful api using node, express, and mongodb in the first hour of a complete node course with the latest version of node and modern javascript.', 'duration': 30.516, 'max_score': 2263.857, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt42263857.jpg'}], 'start': 1622.409, 'title': 'Working with modules in node', 'summary': 'Demonstrates how to work with modules in node.js, including loading modules using the require function, exporting and using module members, and the benefits of using constants. it also mentions the tool jshint for error checking.', 'chapters': [{'end': 1900.484, 'start': 1622.409, 'title': 'Working with modules in node', 'summary': 'Demonstrates how to work with modules in node.js, including loading modules using the require function, exporting and using module members, and the benefits of using constants to store module results, with a mention of the tool jshint for error checking.', 'duration': 278.075, 'highlights': ['The require function in Node is used to load modules and returns the object exported from the target module, simplifying the process of accessing module members.', 'Using constants to store module results when loading a module using the require function is a best practice, as it prevents accidental overwriting of values and potential runtime errors, with an example demonstrating the difference between using a constant and a variable to store the module result.', 'The tool JSHint can be utilized to scan JavaScript code for errors such as attempting to overwrite constants, providing the benefit of identifying errors at compile time instead of at runtime.']}, {'end': 2356.996, 'start': 1900.804, 'title': 'Node module exporting', 'summary': 'Explains how to export a single function from a module instead of an object, demonstrates how node scopes variables and functions within modules, and discusses the local nature of the require function, with practical examples and insights into a comprehensive node course.', 'duration': 456.192, 'highlights': ['Node Module Exporting Explains the concept of exporting a single function from a module instead of an object, illustrating the process of resetting exports to a single function and the benefits of this approach.', 'Node Module Scoping Demonstrates how variables and functions defined in a module are scoped to that module, ensuring their privacy and lack of visibility from the outside, with a practical example of creating a syntactical error and showcasing how Node wraps the code inside a function at runtime.', 'Local Nature of Require Function Discusses the local nature of the require function within each module, highlighting the fact that it is passed as an argument to the module wrapper function and not actually global, with a practical demonstration.', 'Comprehensive Node Course Announces a comprehensive Node course that covers building a real RESTful API using Node, Express, and MongoDB, emphasizing modern JavaScript practices and a real-world project, as well as mentioning various important topics to be covered in the course.']}], 'duration': 734.587, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt41622409.jpg', 'highlights': ['The require function in Node simplifies accessing module members.', 'Using constants when loading a module prevents accidental overwriting of values.', 'JSHint identifies errors at compile time, such as attempting to overwrite constants.', 'Exporting a single function from a module is beneficial.', 'Variables and functions defined in a module are scoped to that module for privacy.', 'The require function is locally scoped within each module.', 'A comprehensive Node course covers building a real RESTful API using Node, Express, and MongoDB.']}, {'end': 2848.393, 'segs': [{'end': 2404.819, 'src': 'embed', 'start': 2356.996, 'weight': 0, 'content': [{'end': 2363.641, 'text': 'useful libraries to use as part of your development, common mistakes that many node developers make, and much, much more.', 'start': 2356.996, 'duration': 6.645}, {'end': 2369.265, 'text': "The course is currently 14 hours long and I'm planning to add more content to it in the future.", 'start': 2364.201, 'duration': 5.064}, {'end': 2374.229, 'text': 'You can watch this course as many times as you want, and if you watch it to the end,', 'start': 2369.886, 'duration': 4.343}, {'end': 2377.872, 'text': 'you will get a certificate of completion that you can add to your resume.', 'start': 2374.229, 'duration': 3.643}, {'end': 2382.115, 'text': "So, if you're serious about adding note to your resume,", 'start': 2378.492, 'duration': 3.623}, {'end': 2387.84, 'text': "I highly encourage you to enroll in the course and don't waste your time jumping from one tutorial to another.", 'start': 2382.115, 'duration': 5.725}, {'end': 2391.363, 'text': 'So, click on the link in the video description to enroll.', 'start': 2388.38, 'duration': 2.983}, {'end': 2392.664, 'text': 'I hope to see you in the course.', 'start': 2391.763, 'duration': 0.901}, {'end': 2404.819, 'text': 'So in the last lecture, I told you that in Node, we have a few useful modules that are built into the core of Node.', 'start': 2398.413, 'duration': 6.406}], 'summary': 'Node development course is 14 hours long with the opportunity to earn a certificate of completion, emphasizing the value of enrolling in the course for serious learners.', 'duration': 47.823, 'max_score': 2356.996, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt42356996.jpg'}, {'end': 2481.621, 'src': 'embed', 'start': 2452.238, 'weight': 1, 'content': [{'end': 2456.021, 'text': 'And some of the items in this list are built-in modules in Node.', 'start': 2452.238, 'duration': 3.783}, {'end': 2460.745, 'text': 'So just that, you can see there are not many modules built into Node.', 'start': 2456.321, 'duration': 4.424}, {'end': 2465.588, 'text': "I'm going to highlight a few very useful modules that you should be aware of.", 'start': 2461.385, 'duration': 4.203}, {'end': 2469.491, 'text': 'for example, we have file system to work with files.', 'start': 2465.588, 'duration': 3.903}, {'end': 2473.234, 'text': "we have HTTP that you're going to learn about later in this section.", 'start': 2469.491, 'duration': 3.743}, {'end': 2477.818, 'text': 'so with this we can create web servers that listen for HTTP requests.', 'start': 2473.234, 'duration': 4.584}, {'end': 2481.621, 'text': 'we have OS to work with the operating system.', 'start': 2477.818, 'duration': 3.803}], 'summary': 'Node has few built-in modules like file system, http, and os, for various tasks.', 'duration': 29.383, 'max_score': 2452.238, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt42452238.jpg'}, {'end': 2525.225, 'src': 'embed', 'start': 2495.836, 'weight': 3, 'content': [{'end': 2499.22, 'text': 'We have a stream, which allows us to work with streams of data.', 'start': 2495.836, 'duration': 3.384}, {'end': 2503.024, 'text': "Again, you're going to learn about this in the future and a bunch of other modules.", 'start': 2499.66, 'duration': 3.364}, {'end': 2506.749, 'text': "Now, in this lecture, we're going to look at this pass module.", 'start': 2503.865, 'duration': 2.884}, {'end': 2512.894, 'text': 'So, on the documentation, you can see all the functions defined in this module.', 'start': 2507.97, 'duration': 4.924}, {'end': 2516.518, 'text': "In this lecture, we're going to use the parse method.", 'start': 2513.775, 'duration': 2.743}, {'end': 2522.143, 'text': 'Now, if you scroll down, you can see how you can use this module.', 'start': 2517.478, 'duration': 4.665}, {'end': 2525.225, 'text': 'So, you have seen the require function before.', 'start': 2522.703, 'duration': 2.522}], 'summary': 'Lecture covers using the pass module and its parse method.', 'duration': 29.389, 'max_score': 2495.836, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt42495836.jpg'}, {'end': 2674.91, 'src': 'embed', 'start': 2648.263, 'weight': 4, 'content': [{'end': 2652.644, 'text': "In this lecture, I'm going to show you how to get information about the current operating system.", 'start': 2648.263, 'duration': 4.381}, {'end': 2660.666, 'text': 'So back in Node documentation in the list of modules, if you scroll down, you can see this OS module.', 'start': 2653.244, 'duration': 7.422}, {'end': 2661.866, 'text': "Let's have a quick look here.", 'start': 2660.906, 'duration': 0.96}, {'end': 2666.047, 'text': 'So these are the methods that are available in this module.', 'start': 2662.766, 'duration': 3.281}, {'end': 2671.168, 'text': 'For example, we have freemem, which returns the amount of free memory on this machine.', 'start': 2666.607, 'duration': 4.561}, {'end': 2674.91, 'text': 'We also have total mem, which is the total memory.', 'start': 2671.608, 'duration': 3.302}], 'summary': "Demonstrating how to access os information using node's os module, including methods like freemem and total mem.", 'duration': 26.647, 'max_score': 2648.263, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt42648263.jpg'}, {'end': 2818.302, 'src': 'embed', 'start': 2788.238, 'weight': 5, 'content': [{'end': 2799.004, 'text': 'So in ECMAScript 6 or ECMAScript 2015, we have a feature called template string, which helps us build a string without concatenations.', 'start': 2788.238, 'duration': 10.766}, {'end': 2800.745, 'text': 'Let me show you how that works.', 'start': 2799.544, 'duration': 1.201}, {'end': 2809.492, 'text': 'So console.log Now, instead of a single quote, we use the back tick character.', 'start': 2801.185, 'duration': 8.307}, {'end': 2813.316, 'text': 'Back tick is the character before number one on your keyboard.', 'start': 2810.213, 'duration': 3.103}, {'end': 2818.302, 'text': 'So here we add some static text like total memory.', 'start': 2814.037, 'duration': 4.265}], 'summary': 'Ecmascript 6 introduces template strings for string building without concatenations.', 'duration': 30.064, 'max_score': 2788.238, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt42788238.jpg'}], 'start': 2356.996, 'title': 'Node.js built-in modules', 'summary': 'Provides an overview of the 14-hour node.js course, emphasizing in-depth content and the importance of enrolling. it introduces built-in modules, focusing on pass and os modules, demonstrating their usage and capabilities such as working with paths and retrieving os information.', 'chapters': [{'end': 2495.095, 'start': 2356.996, 'title': 'Node.js development: built-in modules overview', 'summary': 'Covers the 14-hour node.js course, emphasizing its in-depth content and the importance of enrolling. it also introduces the built-in modules in node.js and encourages viewers to explore them via the nodejs.org documentation.', 'duration': 138.099, 'highlights': ['The course is currently 14 hours long and planning to add more content in the future, allowing unlimited access and offering a certificate of completion.', 'Encouraging enrollment and emphasizing the benefits of committing to the course rather than jumping between tutorials.', 'Introduction to built-in modules in Node.js, highlighting key modules such as file system, HTTP, OS, paths, process, and query strings.']}, {'end': 2848.393, 'start': 2495.836, 'title': 'Working with built-in modules', 'summary': 'Covers the usage of pass and os modules in node.js, demonstrating how to work with paths using the pass module and retrieve information about the operating system using the os module, including methods like total memory and free memory.', 'duration': 352.557, 'highlights': ['The pass module is demonstrated, showcasing the usage of the parse method to work with paths and the benefits of using the pass module over working with strings. The pass module is utilized to demonstrate the parse method for working with paths, highlighting the advantages of using the pass module over traditional string manipulation.', 'The OS module is introduced, displaying methods like total memory and free memory to retrieve information about the operating system. The OS module is introduced, showcasing methods such as total memory and free memory for obtaining information about the operating system.', 'The usage of template strings in ECMAScript 6 is explained, emphasizing the ability to build strings without concatenations. The explanation of template strings in ECMAScript 6 is provided, highlighting their capability to build strings without the use of concatenations.']}], 'duration': 491.397, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt42356996.jpg', 'highlights': ['The course is currently 14 hours long and planning to add more content in the future, allowing unlimited access and offering a certificate of completion.', 'Introduction to built-in modules in Node.js, highlighting key modules such as file system, HTTP, OS, paths, process, and query strings.', 'Encouraging enrollment and emphasizing the benefits of committing to the course rather than jumping between tutorials.', 'The pass module is demonstrated, showcasing the usage of the parse method to work with paths and the benefits of using the pass module over working with strings.', 'The OS module is introduced, displaying methods like total memory and free memory to retrieve information about the operating system.', 'The usage of template strings in ECMAScript 6 is explained, emphasizing the ability to build strings without concatenations.']}, {'end': 3159.739, 'segs': [{'end': 2894.148, 'src': 'embed', 'start': 2849.699, 'weight': 0, 'content': [{'end': 2852.661, 'text': "Okay Now we don't need this first console log.", 'start': 2849.699, 'duration': 2.962}, {'end': 2853.862, 'text': "We're done with this.", 'start': 2853.121, 'duration': 0.741}, {'end': 2856.524, 'text': "Let's go back to the terminal and run this application.", 'start': 2854.342, 'duration': 2.182}, {'end': 2863.826, 'text': 'So node app.js and you can see the total and free memory on my machine.', 'start': 2858.462, 'duration': 5.364}, {'end': 2870.59, 'text': 'Now what is interesting here is that before node, we could not get this kind of information using JavaScript.', 'start': 2864.466, 'duration': 6.124}, {'end': 2877.175, 'text': 'JavaScript used to run only inside of a browser and we could only work with the window or document objects.', 'start': 2871.131, 'duration': 6.044}, {'end': 2880.057, 'text': "We couldn't get information about the operating system.", 'start': 2877.595, 'duration': 2.462}, {'end': 2887.923, 'text': 'But when using Node, our JavaScript code is executed outside of a browser or, as some people say, on the server.', 'start': 2880.737, 'duration': 7.186}, {'end': 2891.186, 'text': 'With this, we can get information about the operating system.', 'start': 2888.443, 'duration': 2.743}, {'end': 2892.627, 'text': 'We can work with files.', 'start': 2891.546, 'duration': 1.081}, {'end': 2894.148, 'text': 'We can work with the network.', 'start': 2892.807, 'duration': 1.341}], 'summary': 'Node.js enables accessing os info, files, network, not possible in browser-based js.', 'duration': 44.449, 'max_score': 2849.699, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt42849699.jpg'}, {'end': 2948.553, 'src': 'embed', 'start': 2920.55, 'weight': 2, 'content': [{'end': 2926.372, 'text': 'In this module, we have a comprehensive set of methods for working with files and directories.', 'start': 2920.55, 'duration': 5.822}, {'end': 2932.913, 'text': "Now in this course, I'm not going to waste your time showing you every single method here because that would be very repetitive.", 'start': 2926.932, 'duration': 5.981}, {'end': 2937.354, 'text': 'But let me show you an example so you see how to work with files in Node.', 'start': 2933.533, 'duration': 3.821}, {'end': 2944.412, 'text': 'So back in VS Code, first, we need to require the FS module.', 'start': 2938.971, 'duration': 5.441}, {'end': 2948.553, 'text': 'We get the result and store it in this constant.', 'start': 2945.552, 'duration': 3.001}], 'summary': 'Module covers comprehensive file and directory methods in node.', 'duration': 28.003, 'max_score': 2920.55, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt42920550.jpg'}, {'end': 3055.4, 'src': 'embed', 'start': 2973.48, 'weight': 3, 'content': [{'end': 2975.402, 'text': 'These are there purely for simplicity.', 'start': 2973.48, 'duration': 1.922}, {'end': 2981.528, 'text': 'In a real world application, you should use asynchronous methods because these are non-blocking.', 'start': 2975.902, 'duration': 5.626}, {'end': 2985.992, 'text': 'So as I told you in the last section, a node process has a single thread.', 'start': 2982.028, 'duration': 3.964}, {'end': 2994.44, 'text': "If you're using node to build the backend for your application, you might have several hundreds or thousands of clients connecting to that backend.", 'start': 2986.732, 'duration': 7.708}, {'end': 2999.081, 'text': "If you keep that single thread busy, you won't be able to serve many clients.", 'start': 2995.1, 'duration': 3.981}, {'end': 3002.162, 'text': 'So always use asynchronous methods.', 'start': 2999.682, 'duration': 2.48}, {'end': 3005.143, 'text': "Now that aside, let's take a look at an example.", 'start': 3002.863, 'duration': 2.28}, {'end': 3009.805, 'text': "We're going to look at read dir or directory method.", 'start': 3005.744, 'duration': 4.061}, {'end': 3014.206, 'text': "First, I'm going to show you the synchronous form because that's easier to understand.", 'start': 3010.525, 'duration': 3.681}, {'end': 3018.448, 'text': 'So as the first argument, we specify the path.', 'start': 3015.067, 'duration': 3.381}, {'end': 3022.174, 'text': 'Period slash represents the current folder.', 'start': 3019.773, 'duration': 2.401}, {'end': 3026.515, 'text': 'And this will return all the files and folders in the current folder.', 'start': 3022.814, 'duration': 3.701}, {'end': 3031.457, 'text': 'So files will be a string array.', 'start': 3027.136, 'duration': 4.321}, {'end': 3034.278, 'text': 'Now we can display that on the console.', 'start': 3032.598, 'duration': 1.68}, {'end': 3036.739, 'text': 'Very simple.', 'start': 3036.199, 'duration': 0.54}, {'end': 3040.44, 'text': 'So node app.js.', 'start': 3038.8, 'duration': 1.64}, {'end': 3047.043, 'text': 'So we can see we get an array of strings and these are the files in this folder on my machine.', 'start': 3041.481, 'duration': 5.562}, {'end': 3051.337, 'text': "Now let's take a look at the asynchronous form of this method.", 'start': 3048.274, 'duration': 3.063}, {'end': 3055.4, 'text': 'So fs.read directory.', 'start': 3052.318, 'duration': 3.082}], 'summary': 'Using asynchronous methods in node.js is crucial for scalability; synchronous methods can block threads and limit client capacity.', 'duration': 81.92, 'max_score': 2973.48, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt42973480.jpg'}, {'end': 3157.819, 'src': 'heatmap', 'start': 3098.79, 'weight': 1, 'content': [{'end': 3099.811, 'text': 'We can call that files.', 'start': 3098.79, 'duration': 1.021}, {'end': 3104.498, 'text': 'So here we need to check if we have an error or the result.', 'start': 3101.536, 'duration': 2.962}, {'end': 3108.64, 'text': 'Only one of these arguments will have a value and the other will be null.', 'start': 3104.878, 'duration': 3.762}, {'end': 3113.083, 'text': "So if we have error, we're going to display it on the console.", 'start': 3109.301, 'duration': 3.782}, {'end': 3121.542, 'text': "error error now, this is not how we handle errors in a real world application, but don't worry about this.", 'start': 3115.037, 'duration': 6.505}, {'end': 3125.644, 'text': 'later in the course we have a complete section about error handling in node.', 'start': 3121.542, 'duration': 4.102}, {'end': 3128.927, 'text': 'for now, we just want to display this error on the console.', 'start': 3125.644, 'duration': 3.283}, {'end': 3130.988, 'text': 'so if you have an error, we displayed.', 'start': 3128.927, 'duration': 2.061}, {'end': 3132.869, 'text': 'otherwise, we display the result.', 'start': 3130.988, 'duration': 1.881}, {'end': 3140.693, 'text': 'so console.log Result and we can display this string array.', 'start': 3132.869, 'duration': 7.824}, {'end': 3152.437, 'text': "So I'm going to comment out These two lines, so we can only look at the result of this asynchronous read directory now, note app.js.", 'start': 3140.693, 'duration': 11.744}, {'end': 3157.819, 'text': 'So we got result and this is exactly the string array that we had before now.', 'start': 3152.437, 'duration': 5.382}], 'summary': 'Check for errors and display on console, otherwise display the result.', 'duration': 59.029, 'max_score': 3098.79, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt43098790.jpg'}], 'start': 2849.699, 'title': 'Node.js and asynchronous methods', 'summary': 'Demonstrates how node.js enables access to operating system information and functionalities like working with files and network, with the example of obtaining total and free memory on the machine. it also explains the importance of using asynchronous methods in node.js to handle multiple client connections efficiently, providing examples of synchronous and asynchronous forms of the read directory method, highlighting the use of callbacks and error handling.', 'chapters': [{'end': 2944.412, 'start': 2849.699, 'title': 'Node.js: working with files and memory', 'summary': 'Demonstrates how using node.js allows javascript code to execute outside of a browser, enabling access to operating system information and functionalities like working with files and network, with the example of obtaining total and free memory on the machine.', 'duration': 94.713, 'highlights': ['Node.js enables JavaScript code to execute outside of a browser, providing access to operating system information and functionalities like working with files and network. Using Node.js, JavaScript code can be executed outside of a browser, allowing access to operating system information and functionalities like working with files and network.', 'Demonstrates the example of obtaining total and free memory on the machine using Node.js. The example showcases the ability to obtain total and free memory on the machine using Node.js.', 'Introduces the file system module in Node.js, offering a comprehensive set of methods for working with files and directories. The lecture introduces the file system module in Node.js, which provides a comprehensive set of methods for working with files and directories.']}, {'end': 3159.739, 'start': 2945.552, 'title': 'Asynchronous methods in node.js', 'summary': 'Explains the importance of using asynchronous methods in node.js to handle multiple client connections efficiently, and provides examples of synchronous and asynchronous forms of the read directory method, highlighting the use of callbacks and error handling.', 'duration': 214.187, 'highlights': ['The importance of using asynchronous methods in Node.js to handle multiple client connections efficiently is emphasized, with the recommendation to avoid using synchronous methods for real-world applications.', 'An example of the synchronous form of the read directory method is provided, demonstrating the usage of fs.readdir to return all the files and folders in the current folder as a string array.', 'An example of the asynchronous form of the read directory method is presented, illustrating the usage of fs.readdir with a callback function to handle the asynchronous operation completion, including error handling and displaying the result.']}], 'duration': 310.04, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt42849699.jpg', 'highlights': ['Node.js enables JavaScript code to execute outside of a browser, providing access to operating system information and functionalities like working with files and network.', 'Demonstrates the example of obtaining total and free memory on the machine using Node.js.', 'Introduces the file system module in Node.js, offering a comprehensive set of methods for working with files and directories.', 'The importance of using asynchronous methods in Node.js to handle multiple client connections efficiently is emphasized, with the recommendation to avoid using synchronous methods for real-world applications.', 'An example of the asynchronous form of the read directory method is presented, illustrating the usage of fs.readdir with a callback function to handle the asynchronous operation completion, including error handling and displaying the result.', 'An example of the synchronous form of the read directory method is provided, demonstrating the usage of fs.readdir to return all the files and folders in the current folder as a string array.']}, {'end': 3731.866, 'segs': [{'end': 3216.405, 'src': 'embed', 'start': 3188.033, 'weight': 2, 'content': [{'end': 3191.374, 'text': 'All these methods come in pairs, asynchronous and synchronous.', 'start': 3188.033, 'duration': 3.341}, {'end': 3194.135, 'text': 'Always prefer to use asynchronous methods.', 'start': 3191.834, 'duration': 2.301}, {'end': 3203.553, 'text': 'One of the core concepts in Node is the concept of events.', 'start': 3199.83, 'duration': 3.723}, {'end': 3209.238, 'text': "In fact, a lot of Node's core functionality is based on this concept of events.", 'start': 3204.234, 'duration': 5.004}, {'end': 3216.405, 'text': 'An event is basically a signal that indicates that something has happened in our application.', 'start': 3210.099, 'duration': 6.306}], 'summary': 'Node.js emphasizes asynchronous methods, with core functionality based on the concept of events.', 'duration': 28.372, 'max_score': 3188.033, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt43188033.jpg'}, {'end': 3295.006, 'src': 'embed', 'start': 3266.393, 'weight': 1, 'content': [{'end': 3271.496, 'text': 'So in this module, we have one class that is called event emitter.', 'start': 3266.393, 'duration': 5.103}, {'end': 3278.121, 'text': "It's one of the core building blocks of node, and a lot of classes are based on this event emitter.", 'start': 3272.157, 'duration': 5.964}, {'end': 3281.123, 'text': "So let's see how we can work with this event emitter.", 'start': 3278.781, 'duration': 2.342}, {'end': 3287.377, 'text': "Back in VS Code, first let's load the events module.", 'start': 3282.452, 'duration': 4.925}, {'end': 3289.279, 'text': 'So require events.', 'start': 3288.018, 'duration': 1.261}, {'end': 3295.006, 'text': 'Now here, when we call the require function, we get the event emitter class.', 'start': 3290.302, 'duration': 4.704}], 'summary': 'Node module features event emitter class, a core building block.', 'duration': 28.613, 'max_score': 3266.393, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt43266393.jpg'}, {'end': 3432.55, 'src': 'embed', 'start': 3402.763, 'weight': 0, 'content': [{'end': 3406.266, 'text': 'One is emit, that we use to raise an event.', 'start': 3402.763, 'duration': 3.503}, {'end': 3414.334, 'text': "The first time I saw this method, it didn't make sense to me because English is my second language and I didn't know what emit means.", 'start': 3407.167, 'duration': 7.167}, {'end': 3420.441, 'text': "So if you're in the same boat, emit basically means making a noise or produce something.", 'start': 3414.895, 'duration': 5.546}, {'end': 3423.744, 'text': "In this case, you're making a noise in our application.", 'start': 3421.121, 'duration': 2.623}, {'end': 3427.348, 'text': "We're signaling that an event has happened.", 'start': 3424.104, 'duration': 3.244}, {'end': 3432.55, 'text': "Okay, so that's the meaning of Emmett and here we pass an argument.", 'start': 3427.868, 'duration': 4.682}], 'summary': 'Emit method signals an event, making a noise in the application.', 'duration': 29.787, 'max_score': 3402.763, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt43402763.jpg'}, {'end': 3509.584, 'src': 'embed', 'start': 3456.198, 'weight': 3, 'content': [{'end': 3461.294, 'text': 'look, nothing happened Because we have raised an event here,', 'start': 3456.198, 'duration': 5.096}, {'end': 3466.997, 'text': 'but nowhere in our application we have registered a listener that is interested in that event.', 'start': 3461.294, 'duration': 5.703}, {'end': 3472.94, 'text': 'A listener is a function that will be called when that event is raised.', 'start': 3467.597, 'duration': 5.343}, {'end': 3480.124, 'text': "okay?. so let's register a listener that will be called when the message log event is raised.", 'start': 3472.94, 'duration': 7.184}, {'end': 3484.007, 'text': 'so register a listener.', 'start': 3480.124, 'duration': 3.883}, {'end': 3486.289, 'text': 'so emitter dot.', 'start': 3484.007, 'duration': 2.282}, {'end': 3492.033, 'text': 'look, here we have this method add listener, but we have an alias for this that we use more often.', 'start': 3486.289, 'duration': 5.744}, {'end': 3493.574, 'text': 'that is on.', 'start': 3492.033, 'duration': 1.541}, {'end': 3495.796, 'text': 'if you have worked with jquery, you have seen this before.', 'start': 3493.574, 'duration': 2.222}, {'end': 3499.038, 'text': "So on or at listener, they're exactly the same.", 'start': 3496.636, 'duration': 2.402}, {'end': 3501.379, 'text': 'But quite often we use the on method.', 'start': 3499.478, 'duration': 1.901}, {'end': 3504.041, 'text': 'Now this method takes two arguments.', 'start': 3502.14, 'duration': 1.901}, {'end': 3506.682, 'text': 'The first one is the name of the event.', 'start': 3504.721, 'duration': 1.961}, {'end': 3509.584, 'text': 'In this case, message logged.', 'start': 3506.803, 'duration': 2.781}], 'summary': "No listener registered for event 'message logged'.", 'duration': 53.386, 'max_score': 3456.198, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt43456198.jpg'}, {'end': 3598.051, 'src': 'embed', 'start': 3566.48, 'weight': 5, 'content': [{'end': 3573.184, 'text': 'Okay So this is the basic of raising events and handling them using the event emitter class.', 'start': 3566.48, 'duration': 6.704}, {'end': 3585.581, 'text': 'Now quite often, when we want to raise an event, we also want to send some data about that event.', 'start': 3579.195, 'duration': 6.386}, {'end': 3595.229, 'text': 'For example, in our logger module, when we log a message, perhaps our remote login service will generate an ID for that message.', 'start': 3586.201, 'duration': 9.028}, {'end': 3598.051, 'text': 'Perhaps we want to return that ID to the client.', 'start': 3595.309, 'duration': 2.742}], 'summary': 'Basic of raising events and handling them with event emitter class.', 'duration': 31.571, 'max_score': 3566.48, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt43566480.jpg'}, {'end': 3649.15, 'src': 'embed', 'start': 3621.88, 'weight': 6, 'content': [{'end': 3630.161, 'text': "if you want to send multiple values about an event, it's a better practice to encapsulate those values inside an object.", 'start': 3621.88, 'duration': 8.281}, {'end': 3641.226, 'text': 'so here we add an object, we give it a couple of properties like id, we set it to id of this message that is logged and another property,', 'start': 3630.161, 'duration': 11.065}, {'end': 3643.187, 'text': 'url like this.', 'start': 3641.226, 'duration': 1.961}, {'end': 3649.15, 'text': 'okay. so we refer to this object as event argument.', 'start': 3643.187, 'duration': 5.963}], 'summary': 'Encapsulate multiple event values in an object with properties like id and url for better practice.', 'duration': 27.27, 'max_score': 3621.88, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt43621880.jpg'}, {'end': 3731.866, 'src': 'embed', 'start': 3707.404, 'weight': 7, 'content': [{'end': 3716.974, 'text': 'With an arrow function, we can get rid of this function keyword So here we have the arguments and after that we have the body of that function.', 'start': 3707.404, 'duration': 9.57}, {'end': 3723.099, 'text': "Now to separate the two, we use an arrow and that's why we call this arrow function.", 'start': 3717.495, 'duration': 5.604}, {'end': 3729.464, 'text': 'You can see this syntax is a little bit simpler and a lot of people prefer to use arrow functions in ES6.', 'start': 3723.7, 'duration': 5.764}, {'end': 3731.866, 'text': "Now here's a simple exercise for you.", 'start': 3730.245, 'duration': 1.621}], 'summary': 'Es6 introduces arrow functions, simplifying syntax and gaining popularity.', 'duration': 24.462, 'max_score': 3707.404, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt43707404.jpg'}], 'start': 3159.739, 'title': 'Node events and event handling', 'summary': 'Covers working with files and directories in node, the concept of events in node, working with the event emitter class, and registering event listeners with emphasis on asynchronous methods and the emit method, along with the process of handling events and passing data as event arguments.', 'chapters': [{'end': 3456.198, 'start': 3159.739, 'title': 'Working with node events', 'summary': 'Covers working with files and directories in node, the concept of events in node, and working with the event emitter class, with emphasis on asynchronous methods and the emit method for raising events.', 'duration': 296.459, 'highlights': ["The concept of events in Node is a core functionality and is based on the concept of events. Node's core functionality is based on the concept of events, with classes like HTTP raising events upon receiving requests.", 'The event emitter class is a core building block of Node, and it defines what an event emitter can do. The event emitter class is a core building block of Node, serving as a blueprint for defining the properties and behavior of an event emitter.', 'The emit method is used to raise an event in Node, signaling that an event has happened. The emit method is used to raise an event in Node by making a noise in the application and signaling that an event has occurred.']}, {'end': 3566.06, 'start': 3456.198, 'title': 'Event listener registration', 'summary': "Explains how to register a listener for an event using the 'on' method, which takes the event name and a callback function as arguments, with a demonstration of the process and emphasis on the importance of order in registering the listener.", 'duration': 109.862, 'highlights': ["The 'on' method is used to register a listener for an event, taking the event name and a callback function as arguments, with an emphasis on the importance of order in registering the listener.", 'The chapter demonstrates the process of registering a listener for an event and executing a callback function when the event is raised.', 'The importance of order in registering the listener is highlighted, with the explanation that registering the listener after calling the emit method would result in no action being taken.']}, {'end': 3731.866, 'start': 3566.48, 'title': 'Handling events with event emitter class', 'summary': 'Discusses raising events and handling them using the event emitter class, including passing data as event arguments, using arrow functions in es6, and simplifying code structure.', 'duration': 165.386, 'highlights': ['Raising events and sending data about the event The chapter explains the concept of raising events and sending data about the event, such as generating an ID for a message in the logger module and returning it to the client.', 'Encapsulating event values inside an object It is recommended to encapsulate multiple values about an event inside an object rather than using magic values, as demonstrated with the example of encapsulating id and URL properties inside an object.', 'Using arrow functions in ES6 for simplifying code The chapter introduces the feature of arrow functions in ES6 as a means to simplify code structure by removing the function keyword and using a more concise syntax, which is preferred by many developers.']}], 'duration': 572.127, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt43159739.jpg', 'highlights': ['The emit method is used to raise an event in Node, signaling that an event has happened.', 'The event emitter class is a core building block of Node, defining what an event emitter can do.', 'The concept of events in Node is a core functionality, based on the concept of events.', "The 'on' method is used to register a listener for an event, emphasizing the importance of order.", 'The chapter demonstrates the process of registering a listener for an event and executing a callback function.', 'Raising events and sending data about the event, such as generating an ID for a message in the logger module.', 'Encapsulating event values inside an object is recommended to avoid using magic values.', 'Using arrow functions in ES6 for simplifying code structure and syntax.']}, {'end': 4693.128, 'segs': [{'end': 3790.968, 'src': 'embed', 'start': 3761.4, 'weight': 3, 'content': [{'end': 3769.605, 'text': 'I just want you to get used to this syntax Now.', 'start': 3761.4, 'duration': 8.205}, {'end': 3775.971, 'text': "in the real world, it's quite rare that you would work with this event emitter object directly.", 'start': 3769.605, 'duration': 6.366}, {'end': 3784.541, 'text': 'Instead, you want to create a class that has all the capabilities of the event emitter and then you will use that class in your code.', 'start': 3776.672, 'duration': 7.869}, {'end': 3787.464, 'text': 'Let me explain what I mean by that and why.', 'start': 3785.081, 'duration': 2.383}, {'end': 3790.968, 'text': "So, let's open up our logger module.", 'start': 3788.165, 'duration': 2.803}], 'summary': 'Use class with event emitter to work efficiently. open logger module.', 'duration': 29.568, 'max_score': 3761.4, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt43761400.jpg'}, {'end': 4070.651, 'src': 'embed', 'start': 4041.477, 'weight': 4, 'content': [{'end': 4048.12, 'text': 'okay, now we want this logger class to have all the capabilities of this event emitter.', 'start': 4041.477, 'duration': 6.643}, {'end': 4058.664, 'text': 'the way we do that is by using the extends keyword that comes in es6, so extends, and here we add the name of the parent or the base class,', 'start': 4048.12, 'duration': 10.544}, {'end': 4062.166, 'text': 'so event emitter.', 'start': 4059.344, 'duration': 2.822}, {'end': 4070.651, 'text': 'and with this simple change, this logger class will have all the functionality that is defined in event emitter.', 'start': 4062.166, 'duration': 8.485}], 'summary': 'Logger class inherits all capabilities of event emitter using extends keyword in es6.', 'duration': 29.174, 'max_score': 4041.477, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt44041477.jpg'}, {'end': 4224.119, 'src': 'embed', 'start': 4194.113, 'weight': 0, 'content': [{'end': 4202.662, 'text': 'If you want to raise events in your application to signal that something has happened, you need to create a class that extends event emitter.', 'start': 4194.113, 'duration': 8.549}, {'end': 4210.871, 'text': 'With this, that class will have all the functionality defined in event emitter, but you can also add additional functionality.', 'start': 4203.283, 'duration': 7.588}, {'end': 4214.234, 'text': 'In this case, we have the ability to log a message.', 'start': 4210.911, 'duration': 3.323}, {'end': 4224.119, 'text': 'And then inside that class, whenever you want to raise an event, you use this that emit, because this references this logger class itself,', 'start': 4214.955, 'duration': 9.164}], 'summary': 'Extend event emitter class to raise events with additional functionality and log messages.', 'duration': 30.006, 'max_score': 4194.113, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt44194113.jpg'}, {'end': 4293.493, 'src': 'embed', 'start': 4266.568, 'weight': 2, 'content': [{'end': 4275.375, 'text': 'And with this we can easily create a backend service for our client applications, like a web application that we built with React or Angular,', 'start': 4266.568, 'duration': 8.807}, {'end': 4278.097, 'text': 'or a mobile application running on a mobile device.', 'start': 4275.375, 'duration': 2.722}, {'end': 4287.31, 'text': 'So, once again, back in the node documentation and the list of modules, you can find this HTTP module and this module.', 'start': 4279.127, 'duration': 8.183}, {'end': 4293.493, 'text': 'you can see various classes like HTTP that agent, HTTP that client request and so on.', 'start': 4287.31, 'duration': 6.183}], 'summary': "Create backend service for client applications using node's http module.", 'duration': 26.925, 'max_score': 4266.568, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt44266568.jpg'}, {'end': 4588.887, 'src': 'embed', 'start': 4559.366, 'weight': 5, 'content': [{'end': 4562.249, 'text': "Okay We're still listening on port 3000.", 'start': 4559.366, 'duration': 2.883}, {'end': 4563.189, 'text': "Let's refresh this page.", 'start': 4562.249, 'duration': 0.94}, {'end': 4566.833, 'text': 'So we got hello world on the homepage.', 'start': 4564.531, 'duration': 2.302}, {'end': 4574.772, 'text': 'Now, if you want to build a backend service for our web or mobile applications, we need to handle various routes here.', 'start': 4567.964, 'duration': 6.808}, {'end': 4584.362, 'text': 'For example, we can have another if block, if request.url equals slash API slash courses.', 'start': 4575.372, 'duration': 8.99}, {'end': 4588.887, 'text': 'Perhaps here we want to return the list of courses from the database.', 'start': 4584.943, 'duration': 3.944}], 'summary': "Listening on port 3000, displaying 'hello world', and handling routes for backend services.", 'duration': 29.521, 'max_score': 4559.366, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt44559366.jpg'}], 'start': 3732.587, 'title': 'Event emitter, logging, and http module in node', 'summary': 'Discusses event emitter and its usage in a logger module, challenges of working with multiple event emitters, and the importance of creating a class with event emitter capabilities. it also covers creating a logger class that extends event emitter, using the http module in node to create a web server, and handling different routes.', 'chapters': [{'end': 3964.071, 'start': 3732.587, 'title': 'Event emitter and logging', 'summary': 'Discusses the concept of event emitter, demonstrating its usage in a logger module and explaining the challenges of working with multiple event emitters and the importance of creating a class with event emitter capabilities for efficient event handling.', 'duration': 231.484, 'highlights': ["The importance of creating a class with event emitter capabilities for efficient event handling It's quite rare that you would work with this event emitter object directly. Instead, you want to create a class that has all the capabilities of the event emitter and then you will use that class in your code.", "Challenges of working with multiple event emitters The reason for this is because here we're working with two different event emitters. In app.js we have this event emitter object and in logger module we have another event emitter object.", "Demonstrating the usage of event emitter in a logger module In this module, we're exporting a simple function log, right? And here we log that message on the console. Now, after this, we want to raise an event."]}, {'end': 4240.155, 'start': 3964.071, 'title': 'Creating a logger class with event emitter', 'summary': "Covers creating a logger class that extends event emitter to raise events and add additional functionality such as logging messages, demonstrating how to use 'extends' keyword in es6 and the process of defining a class, moving functions inside a class, and utilizing the class to raise events and register event listeners.", 'duration': 276.084, 'highlights': ['Creating a class called logger that extends event emitter to have all the functionality of event emitter and add additional capabilities like the ability to log a message By extending the event emitter class, the logger class inherits all the functionality of event emitter and adds the ability to log messages.', "Demonstrating the process of defining a class, moving functions inside a class, and utilizing the class to raise events and register event listeners The process involves defining a class using the 'class' keyword, moving functions inside the class, and using the class to raise events and register event listeners.", "Using 'extends' keyword in ES6 to inherit the functionality of event emitter in the logger class The 'extends' keyword in ES6 is used to inherit the functionality of event emitter in the logger class, allowing the logger class to have all the capabilities of event emitter."]}, {'end': 4693.128, 'start': 4240.155, 'title': 'Using http module in node', 'summary': 'Covers using the http module in node to create a web server that can handle http requests on a given port, register event listeners for new connections, and handle different routes, showcasing how to build a basic backend service for web or mobile applications.', 'duration': 452.973, 'highlights': ['Creating a web server using the HTTP module in Node The HTTP module in Node allows the creation of a web server to handle HTTP requests on a given port.', 'Registering event listeners for new connections The server object can register event listeners for new connections, which are raised every time a new connection or request occurs.', "Handling different routes to build a basic backend service The transcript demonstrates handling different routes, such as '/API/courses', to build a basic backend service for web or mobile applications."]}], 'duration': 960.541, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/TlB_eWDSMt4/pics/TlB_eWDSMt43732587.jpg', 'highlights': ['The importance of creating a class with event emitter capabilities for efficient event handling', 'Creating a class called logger that extends event emitter to have all the functionality of event emitter and add additional capabilities like the ability to log a message', 'Creating a web server using the HTTP module in Node', 'Challenges of working with multiple event emitters', "Using 'extends' keyword in ES6 to inherit the functionality of event emitter in the logger class", 'Handling different routes to build a basic backend service']}], 'highlights': ['Node.js is used in production by large companies like PayPal, Uber, Netflix, and Walmart, with PayPal experiencing significant performance improvements after rebuilding an application with Node, achieving twice the speed with fewer resources, 33% fewer lines of code, and 40% fewer files, and doubling the number of requests served per second while decreasing the average response time by 35%.', 'Node.js allows for the reuse of JavaScript skills, enabling front-end developers to transition to full stack development and benefit from better job opportunities and pay without learning a new programming language.', 'Node.js enables the use of JavaScript on both the front end and back end, leading to cleaner and more consistent source code through unified naming conventions, tools, and best practices.', 'Node.js provides the largest ecosystem of open source libraries, allowing for the addition of free open source libraries to applications, reducing the need to build building blocks from scratch.', 'Node.js is a runtime environment for JavaScript code, similar to browsers, but with different environment objects and additional modules, allowing capabilities such as file system operations and network handling.', 'Node.js applications are highly scalable due to their non-blocking or asynchronous architecture, allowing a single thread to handle multiple requests efficiently.', 'Node applications are highly scalable, ideal for data-intensive and real-time applications.', 'Node should not be used for CPU-intensive applications due to its single-threaded nature.', 'Instructions for installing the latest stable version of Node, focusing on core modules compatibility.', 'Upgrading Node to version 8.9.1, demonstrating the process and indicating the new version.', 'Creating and executing a Node application, demonstrating the process and console output.', "Introduction to Node's modular system and module scope, defining modules as private containers.", 'Creating a module for logging messages, emphasizing reusability.', 'Using a remote logging service to log messages in the cloud, implementing HTTP requests.', 'Exporting specific variables and functions to make them accessible from outside the module.', 'The require function in Node simplifies accessing module members.', 'Using constants when loading a module prevents accidental overwriting of values.', 'JSHint identifies errors at compile time, such as attempting to overwrite constants.', 'Exporting a single function from a module is beneficial.', 'Variables and functions defined in a module are scoped to that module for privacy.', 'The require function is locally scoped within each module.', 'A comprehensive Node course covers building a real RESTful API using Node, Express, and MongoDB.', 'The course is currently 14 hours long and planning to add more content in the future, allowing unlimited access and offering a certificate of completion.', 'Introduction to built-in modules in Node.js, highlighting key modules such as file system, HTTP, OS, paths, process, and query strings.', 'Encouraging enrollment and emphasizing the benefits of committing to the course rather than jumping between tutorials.', 'The pass module is demonstrated, showcasing the usage of the parse method to work with paths and the benefits of using the pass module over working with strings.', 'The OS module is introduced, displaying methods like total memory and free memory to retrieve information about the operating system.', 'The usage of template strings in ECMAScript 6 is explained, emphasizing the ability to build strings without concatenations.', 'Node.js enables JavaScript code to execute outside of a browser, providing access to operating system information and functionalities like working with files and network.', 'Demonstrates the example of obtaining total and free memory on the machine using Node.js.', 'Introduces the file system module in Node.js, offering a comprehensive set of methods for working with files and directories.', 'The importance of using asynchronous methods in Node.js to handle multiple client connections efficiently is emphasized, with the recommendation to avoid using synchronous methods for real-world applications.', 'An example of the asynchronous form of the read directory method is presented, illustrating the usage of fs.readdir with a callback function to handle the asynchronous operation completion, including error handling and displaying the result.', 'An example of the synchronous form of the read directory method is provided, demonstrating the usage of fs.readdir to return all the files and folders in the current folder as a string array.', 'The emit method is used to raise an event in Node, signaling that an event has happened.', 'The event emitter class is a core building block of Node, defining what an event emitter can do.', 'The concept of events in Node is a core functionality, based on the concept of events.', "The 'on' method is used to register a listener for an event, emphasizing the importance of order.", 'The chapter demonstrates the process of registering a listener for an event and executing a callback function.', 'Raising events and sending data about the event, such as generating an ID for a message in the logger module.', 'Encapsulating event values inside an object is recommended to avoid using magic values.', 'Using arrow functions in ES6 for simplifying code structure and syntax.', 'The importance of creating a class with event emitter capabilities for efficient event handling', 'Creating a class called logger that extends event emitter to have all the functionality of event emitter and add additional capabilities like the ability to log a message', 'Creating a web server using the HTTP module in Node', 'Challenges of working with multiple event emitters', "Using 'extends' keyword in ES6 to inherit the functionality of event emitter in the logger class", 'Handling different routes to build a basic backend service']}