title
Node.js Tutorial for Beginners - Getting Started with NodeJS Basics

description
Node.js is probably THE most popular and modern server-side programming language you can dive into these days! Join the full Node course: https://acad.link/nodejs Check out all our other courses: https://academind.com/learn/our-courses ---------- • Go to https://www.academind.com and subscribe to our newsletter to stay updated and to get exclusive content & discounts • Follow @maxedapps and @academind_real on Twitter • Join our Facebook community on https://www.facebook.com/academindchannel/ See you in the videos! ---------- Academind is your source for online education in the areas of web development, frontend web development, backend web development, programming, coding and data science! No matter if you are looking for a tutorial, a course, a crash course, an introduction, an online tutorial or any related video, we try our best to offer you the content you are looking for. Our topics include Angular, React, Vue, Html, CSS, JavaScript, TypeScript, Redux, Nuxt.js, RxJs, Bootstrap, Laravel, Node.js, Progressive Web Apps (PWA), Ionic, React Native, Regular Expressions (RegEx), Stencil, Power BI, Amazon Web Services (AWS), Firebase or other topics, make sure to have a look at this channel or at academind.com to find the learning resource of your choice!

detail
{'title': 'Node.js Tutorial for Beginners - Getting Started with NodeJS Basics', 'heatmap': [{'end': 1388.627, 'start': 1300.235, 'weight': 1}], 'summary': 'This node.js tutorial for beginners covers the introduction of node.js, its role in building interactive user interfaces, and its versatility beyond browser usage, emphasizing core modules, http basics, server operations, event handling, asynchronous execution, performance implications, javascript security features, and node.js fundamentals.', 'chapters': [{'end': 520.806, 'segs': [{'end': 78.765, 'src': 'embed', 'start': 32.642, 'weight': 0, 'content': [{'end': 40.709, 'text': 'for example, to open a pop-up, a modal or add any kinds of effects, because javascript is a language that runs in the browser,', 'start': 32.642, 'duration': 8.067}, {'end': 44.493, 'text': 'that allows you to interact with the page after it was loaded,', 'start': 40.709, 'duration': 3.784}, {'end': 50.659, 'text': 'and it therefore is a crucial part when it comes to building interactive user interfaces in the browser.', 'start': 44.493, 'duration': 6.166}, {'end': 56.065, 'text': 'so, whatever your users see, However, JavaScript is not limited to that.', 'start': 50.659, 'duration': 5.406}, {'end': 61.149, 'text': 'Node.js is a different version of JavaScript, you could say.', 'start': 56.705, 'duration': 4.444}, {'end': 64.251, 'text': 'It is basically built on JavaScript.', 'start': 61.51, 'duration': 2.741}, {'end': 70.077, 'text': 'It adds some features to it, is not capable of doing some other things you can do with JavaScript in the browser.', 'start': 64.532, 'duration': 5.545}, {'end': 74.021, 'text': 'So it basically takes JavaScript and puts it into a different environment.', 'start': 70.458, 'duration': 3.563}, {'end': 78.765, 'text': 'It allows you to run JavaScript code on the server, you could say.', 'start': 74.582, 'duration': 4.183}], 'summary': 'Javascript enables browser interactivity, while node.js allows server-side javascript execution.', 'duration': 46.123, 'max_score': 32.642, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE32642.jpg'}, {'end': 174.457, 'src': 'embed', 'start': 145.468, 'weight': 1, 'content': [{'end': 147.47, 'text': 'also the Node.js JavaScript code.', 'start': 145.468, 'duration': 2.002}, {'end': 151.613, 'text': 'It takes that JavaScript code and compiles it to machine code.', 'start': 148.03, 'duration': 3.583}, {'end': 156.217, 'text': 'And this is what your browser does to what we aid does in your browser.', 'start': 151.914, 'duration': 4.303}, {'end': 160.081, 'text': 'It does take your JavaScript code and compile it to machine code,', 'start': 156.698, 'duration': 3.383}, {'end': 166.626, 'text': 'because that is the code that runs ultimately on your computer and that can be handled efficiently.', 'start': 160.081, 'duration': 6.545}, {'end': 169.29, 'text': 'Now this is done by V8.', 'start': 167.487, 'duration': 1.803}, {'end': 174.457, 'text': "V8 itself is written in C++, but that doesn't really matter too much for you.", 'start': 169.53, 'duration': 4.927}], 'summary': 'V8 compiles javascript code to machine code for efficient handling.', 'duration': 28.989, 'max_score': 145.468, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE145468.jpg'}, {'end': 315.463, 'src': 'embed', 'start': 286.415, 'weight': 2, 'content': [{'end': 287.997, 'text': "Let's do that in the next lecture.", 'start': 286.415, 'duration': 1.582}, {'end': 297.269, 'text': 'So we wanna use Node.js, and the first important step is that we install it.', 'start': 292.605, 'duration': 4.664}, {'end': 301.472, 'text': 'And for that, you have to visit nodejs.org.', 'start': 297.949, 'duration': 3.523}, {'end': 303.854, 'text': 'There, you find an installer.', 'start': 301.973, 'duration': 1.881}, {'end': 305.836, 'text': 'In my case here.', 'start': 304.375, 'duration': 1.461}, {'end': 308.918, 'text': 'I picked the right one for my operating system, macOS,', 'start': 305.836, 'duration': 3.082}, {'end': 315.463, 'text': "but you will also find a version for Windows if you're visiting this page on Windows or you manually choose a different version.", 'start': 308.918, 'duration': 6.545}], 'summary': 'Install node.js by visiting nodejs.org for the next lecture.', 'duration': 29.048, 'max_score': 286.415, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE286415.jpg'}, {'end': 388.296, 'src': 'embed', 'start': 356.329, 'weight': 3, 'content': [{'end': 366.498, 'text': 'And now how do we use Node.js? Well, the easiest way of using it is to open up your local terminal or on Windows, PowerShell or the command prompt.', 'start': 356.329, 'duration': 10.169}, {'end': 371.141, 'text': 'In that terminal, as a first step, simply run node-v.', 'start': 367.659, 'duration': 3.482}, {'end': 374.753, 'text': 'like this.', 'start': 374.352, 'duration': 0.401}, {'end': 377.92, 'text': 'This should show you the version of Node.js you installed.', 'start': 375.294, 'duration': 2.626}, {'end': 388.296, 'text': 'Now, with that being executed, you can now use Node, Just like that, to enter a special input mode, the so-called REPL.', 'start': 378.923, 'duration': 9.373}], 'summary': "Use node.js by running 'node -v' in the terminal.", 'duration': 31.967, 'max_score': 356.329, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE356329.jpg'}, {'end': 439.803, 'src': 'embed', 'start': 411.688, 'weight': 4, 'content': [{'end': 421.132, 'text': 'for that, create a new folder anywhere on your computer and open that folder in your favorite ide or code editor.', 'start': 411.688, 'duration': 9.444}, {'end': 424.033, 'text': 'now here i am using visual studio code you.', 'start': 421.132, 'duration': 2.901}, {'end': 427.675, 'text': 'You can find that on code.visualstudio.com.', 'start': 424.053, 'duration': 3.622}, {'end': 430.877, 'text': 'This is a great IDE, which I strongly recommend using.', 'start': 428.036, 'duration': 2.841}, {'end': 431.678, 'text': "It's free.", 'start': 431.078, 'duration': 0.6}, {'end': 435.841, 'text': 'It is really built for usage with JavaScript code.', 'start': 432.158, 'duration': 3.683}, {'end': 437.402, 'text': 'It will work great.', 'start': 436.141, 'duration': 1.261}, {'end': 439.803, 'text': 'And you can simply download it from this page.', 'start': 437.662, 'duration': 2.141}], 'summary': 'Visual studio code is a free ide recommended for javascript, available at code.visualstudio.com.', 'duration': 28.115, 'max_score': 411.688, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE411688.jpg'}], 'start': 10.305, 'title': 'Node.js introduction and understanding', 'summary': 'Covers the concept of node.js as a javascript runtime, its role in building interactive user interfaces, and its versatility beyond browser usage. it also explains how node.js extends javascript to run on servers and machines, providing features like file system manipulation and guidance on installation and usage, including checking the version, using the repl, and creating new scripts in visual studio code.', 'chapters': [{'end': 56.065, 'start': 10.305, 'title': 'Understanding node.js', 'summary': 'Explains the concept of node.js as a javascript runtime, highlighting its crucial role in building interactive user interfaces and its versatility beyond browser usage.', 'duration': 45.76, 'highlights': ['Node.js is a JavaScript runtime, crucial for building interactive user interfaces in the browser.', 'JavaScript, typically used in the browser, allows interaction with the page after it loads, enabling the manipulation of the DOM and addition of effects.']}, {'end': 520.806, 'start': 56.705, 'title': 'Introduction to node.js', 'summary': 'Explains how node.js extends javascript to run on servers and any machine, providing additional features like file system manipulation and how to install and use node.js, including checking the version, using the repl, and creating a new script in visual studio code.', 'duration': 464.101, 'highlights': ['Node.js extends JavaScript to run on servers and any machine, adding features like working with the local file system, effectively making it a great choice for building web applications that run on servers. Node.js allows running JavaScript outside of the browser and provides additional features like working with the local file system.', 'Node.js uses V8, the JavaScript engine built by Google, to compile JavaScript code to machine code, thus enabling the execution of JavaScript outside the browser. Node.js utilizes V8 to compile JavaScript code to machine code for efficient execution.', 'The installation process for Node.js involves visiting nodejs.org, choosing the appropriate installer for the operating system, and following the steps in the installer to complete the installation. The installation process is straightforward and involves visiting nodejs.org, selecting the appropriate installer, and following the steps to complete the installation.', "To use Node.js, one can open the local terminal, run 'node -v' to check the installed version, and utilize the REPL to execute JavaScript code and create new scripts. Using Node.js involves checking the installed version using 'node -v' and using the REPL to execute JavaScript code and create new scripts.", 'Creating a new script in Visual Studio Code involves opening a new folder in the editor, installing the recommended IDE, and utilizing its features to begin coding. Creating a new script in Visual Studio Code involves opening a new folder, installing the recommended IDE, and utilizing its features for coding.']}], 'duration': 510.501, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE10305.jpg', 'highlights': ['Node.js extends JavaScript to run on servers and any machine, adding features like working with the local file system, effectively making it a great choice for building web applications that run on servers.', 'Node.js uses V8, the JavaScript engine built by Google, to compile JavaScript code to machine code, thus enabling the execution of JavaScript outside the browser.', 'The installation process for Node.js involves visiting nodejs.org, choosing the appropriate installer for the operating system, and following the steps in the installer to complete the installation.', "To use Node.js, one can open the local terminal, run 'node -v' to check the installed version, and utilize the REPL to execute JavaScript code and create new scripts.", 'Creating a new script in Visual Studio Code involves opening a new folder in the editor, installing the recommended IDE, and utilizing its features to begin coding.', 'Node.js is a JavaScript runtime, crucial for building interactive user interfaces in the browser.', 'JavaScript, typically used in the browser, allows interaction with the page after it loads, enabling the manipulation of the DOM and addition of effects.', 'Node.js allows running JavaScript outside of the browser and provides additional features like working with the local file system.']}, {'end': 1864.402, 'segs': [{'end': 911.107, 'src': 'embed', 'start': 887.404, 'weight': 1, 'content': [{'end': 895.553, 'text': "And in general, we have our business logic on the server everything our users shouldn't see, which takes too much time to run in the browser,", 'start': 887.404, 'duration': 8.149}, {'end': 900.318, 'text': 'where we obviously want to deliver a fast user experience or anything of that kind.', 'start': 895.553, 'duration': 4.765}, {'end': 902.68, 'text': 'And that is where we use Node.js.', 'start': 901.039, 'duration': 1.641}, {'end': 907.485, 'text': 'So all the JavaScript code, but this time not on the browser, but on the server.', 'start': 903.001, 'duration': 4.484}, {'end': 911.107, 'text': 'And this is where we use the many features Node.js gives us.', 'start': 908.266, 'duration': 2.841}], 'summary': 'Node.js is used for running business logic on the server to deliver a fast user experience.', 'duration': 23.703, 'max_score': 887.404, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE887404.jpg'}, {'end': 986.366, 'src': 'embed', 'start': 954.027, 'weight': 0, 'content': [{'end': 957.189, 'text': "We'll do that a lot throughout the course, but we haven't done it thus far.", 'start': 954.027, 'duration': 3.162}, {'end': 959.731, 'text': "because it's just a JavaScript runtime.", 'start': 958.01, 'duration': 1.721}, {'end': 968.135, 'text': 'We can execute any JavaScript code with Node.js, and often that is code that runs on a server and is executed upon incoming requests,', 'start': 959.811, 'duration': 8.324}, {'end': 975.178, 'text': 'but you also often use Node.js for other code, for example for local utility scripts or build tools.', 'start': 968.135, 'duration': 7.043}, {'end': 980.862, 'text': "If you worked with, let's say, React or Angular or Vue or anything of that kind,", 'start': 975.598, 'duration': 5.264}, {'end': 986.366, 'text': 'you actually use Node.js indirectly a lot for all the build processes.', 'start': 980.862, 'duration': 5.504}], 'summary': 'Node.js can execute any javascript code, used for server requests and build processes.', 'duration': 32.339, 'max_score': 954.027, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE954027.jpg'}, {'end': 1170.458, 'src': 'embed', 'start': 1147.046, 'weight': 2, 'content': [{'end': 1156.753, 'text': 'The huge advantage, or one huge advantage, of Node.js is that it uses JavaScript, a language which you need so much in modern web development,', 'start': 1147.046, 'duration': 9.707}, {'end': 1158.054, 'text': 'for all the front end.', 'start': 1156.753, 'duration': 1.301}, {'end': 1159.775, 'text': 'for some build tools.', 'start': 1158.454, 'duration': 1.321}, {'end': 1165.536, 'text': "And if you then can also use it on the server side, you don't need to learn a bunch of different languages.", 'start': 1160.035, 'duration': 5.501}, {'end': 1170.458, 'text': 'You can use one of the same language and then use that for your server side code too.', 'start': 1165.736, 'duration': 4.722}], 'summary': 'Node.js uses javascript for front end, build tools, and server side, reducing need to learn multiple languages.', 'duration': 23.412, 'max_score': 1147.046, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE1147046.jpg'}, {'end': 1388.627, 'src': 'heatmap', 'start': 1300.235, 'weight': 1, 'content': [{'end': 1301.055, 'text': 'It makes things easier.', 'start': 1300.235, 'duration': 0.82}, {'end': 1304.277, 'text': 'You will use it if you are working with Node.js.', 'start': 1301.216, 'duration': 3.061}, {'end': 1308.18, 'text': 'But still, of course, we still use Node.js with all of that.', 'start': 1304.618, 'duration': 3.562}, {'end': 1311.832, 'text': "Now thereafter, we'll dive into templating engines.", 'start': 1309.011, 'duration': 2.821}, {'end': 1321.016, 'text': 'That are basically some tools you could say that allow you to generate HTML pages on the server with dynamic content encoded in them.', 'start': 1312.272, 'duration': 8.744}, {'end': 1327.119, 'text': 'And that is how you can return different pages or pages with different content back to your users.', 'start': 1321.356, 'duration': 5.763}, {'end': 1328.98, 'text': 'So that will be an important module.', 'start': 1327.379, 'duration': 1.601}, {'end': 1335.648, 'text': "Now, thereafter, we'll dive into the model view controller pattern, what that is and why we use it, and of course, how we use it.", 'start': 1329.64, 'duration': 6.008}, {'end': 1339.032, 'text': "And we'll then have a look at some advanced routing concepts.", 'start': 1336.189, 'duration': 2.843}, {'end': 1342.457, 'text': "Routing is something we'll also learn in the ExpressJS module.", 'start': 1339.353, 'duration': 3.104}, {'end': 1346.662, 'text': "And we'll dive deeper into the models of the model view controller pattern.", 'start': 1342.957, 'duration': 3.705}, {'end': 1355.869, 'text': "now, after we're done with that, it's time to dive into databases and we'll start by connecting our node application with a sql database,", 'start': 1347.523, 'duration': 8.346}, {'end': 1358.47, 'text': 'mysql to be precise.', 'start': 1355.869, 'duration': 2.601}, {'end': 1364.835, 'text': "as a next step, we'll dive deeper into that and use a package that makes working with sql databases easier sqlize.", 'start': 1358.47, 'duration': 6.365}, {'end': 1371.723, 'text': "Now and, after having seen SQL, we'll continue with NoSQL and see how we would use that.", 'start': 1365.715, 'duration': 6.008}, {'end': 1375.748, 'text': "And we'll use Mongoose there to also make working with that easier.", 'start': 1372.324, 'duration': 3.424}, {'end': 1382.436, 'text': "And we'll then stick to NoSQL for the rest of the course, but you'll thoroughly learn both SQL and NoSQL.", 'start': 1375.988, 'duration': 6.448}, {'end': 1388.627, 'text': "Now, after this, we'll dive into sessions and cookies, what that is, why you use it and how you use it.", 'start': 1383.482, 'duration': 5.145}], 'summary': 'Learn about node.js, templating engines, mvc pattern, advanced routing, sql & nosql databases, sessions, and cookies.', 'duration': 88.392, 'max_score': 1300.235, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE1300235.jpg'}, {'end': 1532.236, 'src': 'embed', 'start': 1507.047, 'weight': 3, 'content': [{'end': 1512.808, 'text': "And we'll also dive into file uploads and REST APIs, authentication, pagination, all that stuff.", 'start': 1507.047, 'duration': 5.761}, {'end': 1518.33, 'text': 'And additionally, these modules will build up on the entire modules before that,', 'start': 1513.228, 'duration': 5.102}, {'end': 1524.533, 'text': 'because you will learn that a REST API does not differ that much from a normal node application.', 'start': 1518.33, 'duration': 6.203}, {'end': 1532.236, 'text': 'And I will show you in detail which knowledge you still need and how you need to change some things, not that many actually,', 'start': 1524.873, 'duration': 7.363}], 'summary': 'The training covers file uploads, rest apis, authentication, and pagination, building on previous modules.', 'duration': 25.189, 'max_score': 1507.047, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE1507047.jpg'}], 'start': 520.806, 'title': 'Node.js course overview', 'summary': 'Provides a comprehensive overview of a node.js course, covering topics such as model view controller pattern, databases, sessions, authentication, file handling, rest and graphql apis, deployment, and emphasizes active learning and project building.', 'chapters': [{'end': 827.952, 'start': 520.806, 'title': 'Introduction to node.js', 'summary': 'Introduces the setup process for a javascript app using node.js, including creating a file, executing code, and accessing local file system. it also explains the purpose of node.js and its usage in server-side code.', 'duration': 307.146, 'highlights': ['Node.js allows executing JavaScript code locally without a browser, enabling access to local file system and server-side code execution. Node.js enables the execution of JavaScript code locally without the need for a browser, providing access to the local file system and facilitating server-side code execution.', 'Creating a new file and writing text to it using Node.js demonstrates its capability to interact with the local file system. The demonstration of creating a new file and writing text to it using Node.js showcases its capability to interact with the local file system.', "Introduction to the purpose of Node.js in server-side code execution, highlighting its role in processing incoming requests and generating responses. The explanation of Node.js's purpose in server-side code execution emphasizes its role in processing incoming requests and generating responses."]}, {'end': 1098.178, 'start': 827.952, 'title': 'Node.js for server-side code', 'summary': 'Discusses the usage of node.js for server-side tasks such as database connectivity, user authentication, and business logic, emphasizing its role in executing javascript code on the server and its versatility for utility scripts and build processes.', 'duration': 270.226, 'highlights': ['Node.js usage for server-side tasks like database connectivity, user authentication, and business logic Node.js is utilized for server-side tasks such as connecting to databases, user authentication, and handling business logic.', 'Execution of JavaScript code on the server using Node.js Node.js is used to execute JavaScript code on the server, shielding it from user manipulation and ensuring a secure environment.', 'Versatility of Node.js for utility scripts, build tools, and non-server side language usages Node.js is versatile, enabling the creation of utility scripts, build tools, and non-server side language usages, such as those required by React, Angular, or Vue.']}, {'end': 1328.98, 'start': 1098.178, 'title': 'Node.js: language overview & advantages', 'summary': 'Discusses the advantages of node.js, highlighting its efficiency, performance, and popularity, as well as the broad variety of languages it can replace, emphasizing its use of javascript for both front-end and server-side development.', 'duration': 230.802, 'highlights': ['The huge advantage of Node.js is its use of JavaScript, a highly performant and popular language, offering efficiency and a broad variety of languages it can replace.', 'Node.js allows developers to use one language for both front-end and server-side code, leading to increased efficiency and eliminating the need to learn multiple languages.', 'Node.js is widely used, with numerous job opportunities, making it a great language to learn for modern web development.', 'Node.js is trending, fast, efficient, and ensures that developers only need to learn one language for modern web application development.', 'The course will cover a JavaScript refresher and delve into Node.js basics, including working with streams of data and core Node.js modules, followed by a focus on efficiently developing with Node.js and handling errors.']}, {'end': 1864.402, 'start': 1329.64, 'title': 'Node.js course overview', 'summary': 'Covers a comprehensive overview of the node.js course, including topics such as model view controller pattern, databases (sql and nosql), sessions and cookies, authentication, file uploads and downloads, rest and graphql apis, deployment, and additional functionalities. it emphasizes the importance of active learning, project building, and utilizing all available course resources.', 'duration': 534.762, 'highlights': ['The chapter covers a comprehensive overview of the Node.js course, including topics such as model view controller pattern, databases (SQL and NoSQL), sessions and cookies, authentication, file uploads and downloads, REST and GraphQL APIs, deployment, and additional functionalities. It mentions the key topics covered in the course, providing an overview of the content to be expected.', 'It emphasizes the importance of active learning, project building, and utilizing all available course resources. Encourages active participation, project completion, and thorough utilization of course resources for effective learning.']}], 'duration': 1343.596, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE520806.jpg', 'highlights': ['Node.js allows executing JavaScript code locally without a browser, enabling access to local file system and server-side code execution.', 'Node.js is utilized for server-side tasks such as connecting to databases, user authentication, and handling business logic.', 'The huge advantage of Node.js is its use of JavaScript, a highly performant and popular language, offering efficiency and a broad variety of languages it can replace.', 'The chapter covers a comprehensive overview of the Node.js course, including topics such as model view controller pattern, databases (SQL and NoSQL), sessions and cookies, authentication, file uploads and downloads, REST and GraphQL APIs, deployment, and additional functionalities.']}, {'end': 2455.426, 'segs': [{'end': 2036.279, 'src': 'embed', 'start': 2006.707, 'weight': 3, 'content': [{'end': 2013.95, 'text': 'the advantage, of course, is and that is why we use it for real apps that we write our code in advance and we can always execute it.', 'start': 2006.707, 'duration': 7.243}, {'end': 2020.672, 'text': 'And when we build a real app, we want to save our code, of course, in files which we can then deploy in the end,', 'start': 2014.23, 'duration': 6.442}, {'end': 2027.534, 'text': 'which we could share with our developers and where we can also pause our work and pick up later and where we never lose the code we write.', 'start': 2020.672, 'duration': 6.862}, {'end': 2036.279, 'text': 'But the REPL is a great playground because we can use that to run some commands, to try out certain things because we execute code as we write it.', 'start': 2028.154, 'duration': 8.125}], 'summary': 'Using repl for real apps allows for code execution and sharing, and serves as a playground for trying out commands and executing code.', 'duration': 29.572, 'max_score': 2006.707, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE2006707.jpg'}, {'end': 2122.051, 'src': 'embed', 'start': 2099.176, 'weight': 1, 'content': [{'end': 2107.902, 'text': 'We obviously have to make sure that we all understand how the web works and which role Node.js plays in that bigger picture.', 'start': 2099.176, 'duration': 8.726}, {'end': 2110.504, 'text': 'Now, this will only be a brief refresher.', 'start': 2108.743, 'duration': 1.761}, {'end': 2119.59, 'text': "Obviously, we'll then dive into creating such a Node.js server and running Node.js code when requests are reaching that server.", 'start': 2110.884, 'duration': 8.706}, {'end': 2122.051, 'text': "And of course, we'll also send back responses.", 'start': 2119.87, 'duration': 2.181}], 'summary': 'Node.js plays a role in web development, creating servers, and handling requests and responses.', 'duration': 22.875, 'max_score': 2099.176, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE2099176.jpg'}, {'end': 2179.66, 'src': 'embed', 'start': 2146.761, 'weight': 0, 'content': [{'end': 2156.306, 'text': "so that you'll learn how you can use node.js and the many features it offers to accept incoming requests and do something with them, for example,", 'start': 2146.761, 'duration': 9.545}, {'end': 2160.008, 'text': 'parse them and how to send back responses.', 'start': 2156.306, 'duration': 3.702}, {'end': 2162.809, 'text': 'these are crucial things you gotta know now.', 'start': 2160.008, 'duration': 2.801}, {'end': 2164.631, 'text': 'related to all of that,', 'start': 2162.809, 'duration': 1.822}, {'end': 2179.66, 'text': "we'll learn how node.js uses asynchronous code and a concept called the event loop to stay reactive and ensure that our script never slows down and always works just fine.", 'start': 2164.631, 'duration': 15.029}], 'summary': 'Learn to use node.js for handling incoming requests and responses, and understand its asynchronous code and event loop concept for script efficiency.', 'duration': 32.899, 'max_score': 2146.761, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE2146761.jpg'}, {'end': 2387.252, 'src': 'embed', 'start': 2359.94, 'weight': 2, 'content': [{'end': 2368.144, 'text': 'to correctly handle a request and send back a response the browser can work with we have to follow some rules,', 'start': 2359.94, 'duration': 8.204}, {'end': 2373.147, 'text': 'and these rules are defined by the protocol we use http or https.', 'start': 2368.144, 'duration': 5.003}, {'end': 2380.529, 'text': 'HTTP stands for Hypertext Transfer Protocol, and there we simply define, or it is defined,', 'start': 2374.367, 'duration': 6.162}, {'end': 2387.252, 'text': 'how a valid request looks like and how the data should be transferred from browser to server and the other way around.', 'start': 2380.529, 'duration': 6.723}], 'summary': 'Following http/https rules is crucial for handling requests and sending back responses.', 'duration': 27.312, 'max_score': 2359.94, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE2359940.jpg'}], 'start': 1864.402, 'title': 'Node.js and web servers', 'summary': 'Explains the benefits of using repl and executing files to run node.js code, the role of node.js in the web, use of core modules to handle requests and responses, asynchronous code, event loop, user interaction with web pages, handling incoming requests, and the use of http and https protocols for data transfer, along with enabling ssl encryption.', 'chapters': [{'end': 2196.586, 'start': 1864.402, 'title': 'Node.js basics & web server overview', 'summary': 'Explains the benefits of using the repl and executing files to run node.js code, the role of node.js in the web, and the use of core modules to handle requests and responses, along with the concept of asynchronous code and the event loop.', 'duration': 332.184, 'highlights': ['The REPL is a great playground for trying out code, but not for writing real applications. The REPL allows for direct input and immediate execution of code, making it suitable for testing features and running commands, but not for developing real applications.', 'Executing files is the alternative to using the REPL, allowing code to be written in advance and saved for future execution. The approach of executing files enables the development of real applications, as the code can be written in advance, saved in files, shared with other developers, and deployed for use.', 'Node.js plays a crucial role in handling incoming requests, parsing them, and sending back responses in web server development. Node.js is used to accept incoming requests, parse them, and send back responses, essential for creating and running a web server.', 'Node.js uses asynchronous code and the event loop to ensure reactive behavior and prevent script slowdown. Node.js employs asynchronous code and the event loop to maintain reactive behavior and prevent script slowdown, thereby ensuring optimal performance.']}, {'end': 2455.426, 'start': 2196.766, 'title': 'Node.js and web servers', 'summary': 'Explains the process of a user interacting with web pages, the role of node.js in handling incoming requests, and the use of http and https protocols for data transfer, with an overview of enabling ssl encryption.', 'duration': 258.66, 'highlights': ['Node.js is the code that makes up the server handling incoming requests, enabling the server to handle user input validation, communication with the database, and sending back responses to the client. Node.js serves as the code to handle incoming requests, perform user input validation, and communicate with the database, ultimately sending responses to the client.', 'The web generally works by transmitting requests and responses through HTTP or HTTPS protocols, with the latter providing SSL encryption for secure data transmission. HTTP and HTTPS protocols are used for transmitting requests and responses, with HTTPS offering SSL encryption for secure data transmission.', 'Towards the end, the course will cover the process of enabling HTTPS for secure data transmission, especially when the code is put into production. The course will demonstrate how to enable HTTPS for secure data transmission, especially for production environments.']}], 'duration': 591.024, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE1864402.jpg', 'highlights': ['Node.js plays a crucial role in handling incoming requests, parsing them, and sending back responses in web server development.', 'Node.js serves as the code to handle incoming requests, perform user input validation, and communicate with the database, ultimately sending responses to the client.', 'HTTP and HTTPS protocols are used for transmitting requests and responses, with HTTPS offering SSL encryption for secure data transmission.', 'The approach of executing files enables the development of real applications, as the code can be written in advance, saved in files, shared with other developers, and deployed for use.']}, {'end': 3508.598, 'segs': [{'end': 2482.969, 'src': 'embed', 'start': 2455.426, 'weight': 0, 'content': [{'end': 2463.789, 'text': 'so i have an empty folder and again i will now create a new file with command n or by pressing this icon here and And.', 'start': 2455.426, 'duration': 8.363}, {'end': 2470.756, 'text': 'this file can have any name you want, but often you name it server.js or app.js,', 'start': 2463.789, 'duration': 6.967}, {'end': 2475.161, 'text': 'because it is the root file that makes up your Node.js application.', 'start': 2470.756, 'duration': 4.405}, {'end': 2480.887, 'text': 'So the Node.js code you will execute on a computer in the cloud on a server in the end.', 'start': 2475.441, 'duration': 5.446}, {'end': 2482.969, 'text': "So I'll name it app.js here.", 'start': 2481.488, 'duration': 1.481}], 'summary': "Creating a new file 'app.js' as root file for node.js application.", 'duration': 27.543, 'max_score': 2455.426, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE2455426.jpg'}, {'end': 2542.897, 'src': 'embed', 'start': 2499.904, 'weight': 1, 'content': [{'end': 2512.756, 'text': 'because the way javascript works both in the browser and node.js There is a handful of functions and objects we can use globally without importing anything into that file.', 'start': 2499.904, 'duration': 12.852}, {'end': 2521.924, 'text': "But generally most functionalities aren't available by default, to not pollute our global namespace with all these reserved keywords and names,", 'start': 2513.296, 'duration': 8.628}, {'end': 2528.01, 'text': 'basically, and also to make it very obvious in each file on which functionalities this file depends.', 'start': 2521.924, 'duration': 6.086}, {'end': 2531.073, 'text': 'Thus far, this file does not depend on anything.', 'start': 2528.53, 'duration': 2.543}, {'end': 2535.574, 'text': 'Now, there are a couple of core modules Node.js ships with.', 'start': 2531.793, 'duration': 3.781}, {'end': 2540.936, 'text': 'And as you will learn throughout the course, you can also install third-party modules which do not ship with Node.', 'start': 2536.015, 'duration': 4.921}, {'end': 2542.897, 'text': "But let's stick to the core modules for now.", 'start': 2541.176, 'duration': 1.721}], 'summary': "Javascript in browser and node.js has global functions and objects, but most functionalities aren't available by default. node.js ships with core modules and can also install third-party modules.", 'duration': 42.993, 'max_score': 2499.904, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE2499904.jpg'}, {'end': 2594.004, 'src': 'embed', 'start': 2566.417, 'weight': 3, 'content': [{'end': 2571.98, 'text': 'There is the OS package, which helps us with operating system relevant information and so on.', 'start': 2566.417, 'duration': 5.563}, {'end': 2576.663, 'text': 'And there are the two topmost packages, HTTP and HTTPS.', 'start': 2572.661, 'duration': 4.002}, {'end': 2586.369, 'text': 'And as you might be able to guess, these two sound very helpful when it comes to creating a server and working with HTTP requests and HTTP responses.', 'start': 2577.183, 'duration': 9.186}, {'end': 2594.004, 'text': 'And indeed HTTP helps us with launching a server or also with other tasks like sending requests,', 'start': 2587.478, 'duration': 6.526}], 'summary': 'Os package provides operating system info. topmost packages are http and https for creating server and handling http requests and responses.', 'duration': 27.587, 'max_score': 2566.417, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE2566417.jpg'}, {'end': 2665.361, 'src': 'embed', 'start': 2634.08, 'weight': 4, 'content': [{'end': 2641.947, 'text': 'So we basically need to make sure that we can use features from that HTTP module which Node.js ships with,', 'start': 2634.08, 'duration': 7.867}, {'end': 2645.749, 'text': 'but which still is not available globally by default.', 'start': 2641.947, 'duration': 3.802}, {'end': 2649.733, 'text': 'We need to make sure that we can use these features in this file.', 'start': 2646.39, 'duration': 3.343}, {'end': 2653.416, 'text': 'And for this, we import that functionality.', 'start': 2650.313, 'duration': 3.103}, {'end': 2665.361, 'text': "We do this by creating a new constant, and you could create a var or use let too, but since we'll have some value here which we will never change,", 'start': 2654.116, 'duration': 11.245}], 'summary': 'Using modules from node.js http module to ensure global functionality in file.', 'duration': 31.281, 'max_score': 2634.08, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE2634080.jpg'}, {'end': 2827.574, 'src': 'embed', 'start': 2801.98, 'weight': 5, 'content': [{'end': 2810.765, 'text': 'now, as the name suggests, this is a crucial method when it comes to well creating a server and create server.', 'start': 2801.98, 'duration': 8.785}, {'end': 2818.249, 'text': 'actually, if we hover over it, we can see it actually takes a so-called request listener as an argument.', 'start': 2810.765, 'duration': 7.484}, {'end': 2825.333, 'text': 'a request listener simply is a function that will execute for every incoming request.', 'start': 2818.249, 'duration': 7.084}, {'end': 2827.574, 'text': "so let's define such a function.", 'start': 2825.333, 'duration': 2.241}], 'summary': 'Crucial method for creating a server and defining a request listener.', 'duration': 25.594, 'max_score': 2801.98, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE2801980.jpg'}, {'end': 3122.025, 'src': 'embed', 'start': 3091.48, 'weight': 7, 'content': [{'end': 3094.021, 'text': 'The first one is the port on which you want to listen.', 'start': 3091.48, 'duration': 2.541}, {'end': 3100.646, 'text': 'Now, in production, you typically would not fill this out and it would take the default of port 80.', 'start': 3094.442, 'duration': 6.204}, {'end': 3106.309, 'text': 'But here on local development, we want to use a different port and you can also define a host name.', 'start': 3100.646, 'duration': 5.663}, {'end': 3110.452, 'text': 'Now, by default, this will be the name of the machine this is running on.', 'start': 3106.73, 'duration': 3.722}, {'end': 3114.195, 'text': 'So for our local machine, this is local host by default.', 'start': 3110.692, 'duration': 3.503}, {'end': 3122.025, 'text': "So let's just pass a port 3000 is a port you often use, but you're relatively free to use any port you want.", 'start': 3114.815, 'duration': 7.21}], 'summary': 'Configure local development server to listen on port 3000.', 'duration': 30.545, 'max_score': 3091.48, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE3091480.jpg'}, {'end': 3436.889, 'src': 'embed', 'start': 3408.483, 'weight': 6, 'content': [{'end': 3412.106, 'text': 'Well, it is super fast in handling these requests.', 'start': 3408.483, 'duration': 3.623}, {'end': 3417.81, 'text': 'And actually behind the scenes, it does some multi-threading by leveraging the operating system.', 'start': 3412.366, 'duration': 5.444}, {'end': 3420.392, 'text': 'But this event loop is a core thing.', 'start': 3418.451, 'duration': 1.941}, {'end': 3426.337, 'text': 'you have to keep in mind that Node.js basically has an ongoing loop as long as there are listeners,', 'start': 3420.392, 'duration': 5.945}, {'end': 3429.079, 'text': 'and create server creates a listener which never stops.', 'start': 3426.337, 'duration': 2.742}, {'end': 3436.889, 'text': 'But if you eventually were to unregister and you can do this with process.exit, it would end.', 'start': 3430.285, 'duration': 6.604}], 'summary': 'Node.js handles requests super fast with multi-threading and event loop, creating an ongoing loop with listeners and servers.', 'duration': 28.406, 'max_score': 3408.483, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE3408483.jpg'}, {'end': 3517.941, 'src': 'embed', 'start': 3484.822, 'weight': 8, 'content': [{'end': 3488.184, 'text': 'If it quits, people will not be able to reach your web page anymore.', 'start': 3484.822, 'duration': 3.362}, {'end': 3491.166, 'text': 'But this is important for understanding how this works.', 'start': 3488.724, 'duration': 2.442}, {'end': 3500.712, 'text': 'Process exit basically hard exited our event loop and therefore the program shuts down because there was no more work to do.', 'start': 3491.626, 'duration': 9.086}, {'end': 3508.598, 'text': 'Node.js saw that there is no more work to do, and it basically closed the program and gave control back to our terminal here.', 'start': 3501.113, 'duration': 7.485}, {'end': 3517.941, 'text': 'So this is how we execute such a Node.js file and how we generally create such a server and what Node.js does behind the scenes.', 'start': 3509.498, 'duration': 8.443}], 'summary': 'Node.js hard exit shuts down program when no more work, impacting web page access.', 'duration': 33.119, 'max_score': 3484.822, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE3484822.jpg'}], 'start': 2455.426, 'title': 'Node.js server creation and http basics', 'summary': 'Covers creating a node.js server, naming the root file as app.js, and the importance of importing core modules. it also delves into the basics of creating an http server, including importing the http module, defining a request listener, and executing the server.', 'chapters': [{'end': 2565.857, 'start': 2455.426, 'title': 'Creating a node.js server', 'summary': 'Discusses creating a node.js server, naming the root file as app.js, and the importance of importing core modules in node.js for functionality.', 'duration': 110.431, 'highlights': ['Naming the root file as app.js for a Node.js application Naming the root file as app.js is a convention for the file that makes up a Node.js application.', 'Importing core modules in Node.js for functionality Core modules in Node.js, such as FS and path, are important for various functionalities and file system operations.', 'Explanation of the importance of importing functionality in Node.js to avoid polluting global namespace Importing functionality in Node.js avoids polluting the global namespace with reserved keywords and names, making it clear on which functionalities a file depends.']}, {'end': 3063.72, 'start': 2566.417, 'title': 'Node.js http server basics', 'summary': 'Covers the basics of creating an http server using node.js, including importing the http module, creating a server, defining a request listener, and executing the server.', 'duration': 497.303, 'highlights': ['Node.js HTTP and HTTPS packages are crucial for server creation and working with HTTP requests and responses The HTTP and HTTPS packages in Node.js are essential for creating servers and working with HTTP requests and responses, allowing for communication between multiple servers and the possibility of sending requests to external APIs.', 'Importing the HTTP module using the require keyword in Node.js The HTTP module is imported using the require keyword in Node.js, allowing the usage of its functionalities within the file, and the createServer method is a crucial feature provided by the HTTP module.', 'Defining and using a request listener function for incoming HTTP requests A request listener function is defined and used to handle incoming HTTP requests, receiving data about the request and allowing the sending of a response, demonstrating event-driven architecture in Node.js.']}, {'end': 3508.598, 'start': 3064.2, 'title': 'Creating web servers with node.js', 'summary': 'Discusses creating web servers with node.js, covering the listen method, handling incoming requests, and the event loop concept, demonstrating how to keep the server running and handle multiple incoming requests efficiently.', 'duration': 444.398, 'highlights': ['Node.js uses an event loop to keep the server running and handle multiple incoming requests efficiently. Node.js event loop concept, handling multiple incoming requests', 'The listen method in Node.js takes optional arguments for defining the port and host name, allowing flexibility in local development. Flexibility in defining port and host name for local development', 'The process.exit function can be used to hard exit the event loop and shut down the program. Functionality of process.exit in shutting down the program']}], 'duration': 1053.172, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE2455426.jpg', 'highlights': ['Naming the root file as app.js for a Node.js application is a convention', 'Importing core modules in Node.js, such as FS and path, are important for various functionalities', 'Importing functionality in Node.js avoids polluting the global namespace with reserved keywords and names', 'The HTTP and HTTPS packages in Node.js are essential for creating servers and working with HTTP requests and responses', 'The HTTP module is imported using the require keyword in Node.js, allowing the usage of its functionalities within the file', 'A request listener function is defined and used to handle incoming HTTP requests, demonstrating event-driven architecture in Node.js', 'Node.js uses an event loop to keep the server running and handle multiple incoming requests efficiently', 'Flexibility in defining port and host name for local development', 'Functionality of process.exit in shutting down the program']}, {'end': 4356.714, 'segs': [{'end': 3567.791, 'src': 'embed', 'start': 3539.355, 'weight': 1, 'content': [{'end': 3549.721, 'text': 'this request object is the object Node.js generated for us with all the data of the incoming request when we visited localhost 3000,', 'start': 3539.355, 'duration': 10.366}, {'end': 3554.464, 'text': 'which we in turn can do because we listen to requests on that port.', 'start': 3549.721, 'duration': 4.743}, {'end': 3557.066, 'text': 'So this is the request object.', 'start': 3555.405, 'duration': 1.661}, {'end': 3561.168, 'text': "If we have a look at it, we see it's a very complex object.", 'start': 3557.926, 'duration': 3.242}, {'end': 3562.889, 'text': "There's lots of data in it.", 'start': 3561.228, 'duration': 1.661}, {'end': 3564.17, 'text': "It's not just data.", 'start': 3563.129, 'duration': 1.041}, {'end': 3567.791, 'text': 'These are also partly functions we can call and so on.', 'start': 3564.55, 'duration': 3.241}], 'summary': 'The request object in node.js contains complex data and functions for handling incoming requests on port 3000.', 'duration': 28.436, 'max_score': 3539.355, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE3539355.jpg'}, {'end': 3719.22, 'src': 'embed', 'start': 3696.601, 'weight': 0, 'content': [{'end': 3706.089, 'text': 'now we see another output and there we see slash test being logged here and then also get for the method and our headers.', 'start': 3696.601, 'duration': 9.488}, {'end': 3711.393, 'text': 'so this is basically how we can access some information about our request.', 'start': 3706.089, 'duration': 5.304}, {'end': 3715.797, 'text': 'now one crucial thing that is missing here is the response.', 'start': 3711.393, 'duration': 4.404}, {'end': 3719.22, 'text': "so let's have a look at sending responses in the next lecture.", 'start': 3715.797, 'duration': 3.423}], 'summary': 'Learned accessing request information, missing response.', 'duration': 22.619, 'max_score': 3696.601, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE3696601.jpg'}, {'end': 3860.555, 'src': 'embed', 'start': 3815.819, 'weight': 3, 'content': [{'end': 3822.644, 'text': "And after this lecture, you'll find another lecture with some link where you can learn which headers you can set.", 'start': 3815.819, 'duration': 6.825}, {'end': 3824.745, 'text': "Now, you don't need to set that many.", 'start': 3822.964, 'duration': 1.781}, {'end': 3825.466, 'text': 'Let me say that.', 'start': 3824.765, 'duration': 0.701}, {'end': 3831.991, 'text': "And later we will even learn about a package that does this for us so that we don't have to set the content type on our own.", 'start': 3825.826, 'duration': 6.165}, {'end': 3833.792, 'text': 'But here I will set it.', 'start': 3832.691, 'duration': 1.101}, {'end': 3842.2, 'text': "Now, one important thing is missing, of course, and that is the HTML code, right? Thus far, I'm saying we have HTML code, but I'm not sending it.", 'start': 3834.152, 'duration': 8.048}, {'end': 3845.082, 'text': 'Now, we do this by setting response.', 'start': 3843.04, 'duration': 2.042}, {'end': 3848.846, 'text': 'And now we can set right here.', 'start': 3846.343, 'duration': 2.503}, {'end': 3853.449, 'text': 'write allows us to write some data to the response.', 'start': 3849.566, 'duration': 3.883}, {'end': 3858.133, 'text': 'And this basically works in chunks, you could say, or in multiple lines.', 'start': 3853.709, 'duration': 4.424}, {'end': 3860.555, 'text': 'This would be a good picture to look at this.', 'start': 3858.433, 'duration': 2.122}], 'summary': 'The lecture covers setting headers and writing data to responses in chunks.', 'duration': 44.736, 'max_score': 3815.819, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE3815819.jpg'}, {'end': 4080.151, 'src': 'embed', 'start': 4051.377, 'weight': 2, 'content': [{'end': 4056.743, 'text': "Now let's connect both the request data we can get and the response data we can send.", 'start': 4051.377, 'duration': 5.366}, {'end': 4071.801, 'text': 'In the last lectures we learned how to spin up that server and that we got a request object with information about the incoming request and the response object that we can use to send back a response.', 'start': 4061.388, 'duration': 10.413}, {'end': 4074.725, 'text': "Let's now connect both request and response.", 'start': 4072.242, 'duration': 2.483}, {'end': 4080.151, 'text': "Instead of printing some request data to the console, which of course doesn't do much for us,", 'start': 4075.165, 'duration': 4.986}], 'summary': 'Connecting request and response data for server communication.', 'duration': 28.774, 'max_score': 4051.377, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE4051377.jpg'}, {'end': 4267.012, 'src': 'embed', 'start': 4236.425, 'weight': 4, 'content': [{'end': 4239.686, 'text': 'And then we define the method, the HTTP method that should be used.', 'start': 4236.425, 'duration': 3.261}, {'end': 4247.729, 'text': 'And there we previously saw, if we expand this, that we got a GET request, which is the default if we enter a URL.', 'start': 4240.106, 'duration': 7.623}, {'end': 4250.11, 'text': "Well, here we're not entering a URL.", 'start': 4248.07, 'duration': 2.04}, {'end': 4253.552, 'text': 'Instead, we want to send a so-called POST request.', 'start': 4250.571, 'duration': 2.981}, {'end': 4257.909, 'text': 'There is a limited set of HTTP words you can use.', 'start': 4254.588, 'duration': 3.321}, {'end': 4261.89, 'text': 'Get and post are the two most important ones.', 'start': 4258.649, 'duration': 3.241}, {'end': 4267.012, 'text': 'A get request is automatically sent when you click a link or enter a URL.', 'start': 4262.751, 'duration': 4.261}], 'summary': 'Defining http methods: get and post, important for sending requests.', 'duration': 30.587, 'max_score': 4236.425, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE4236425.jpg'}], 'start': 3509.498, 'title': 'Node.js server, request handling, and html response', 'summary': 'Discusses creating a node.js server, manipulating request data, setting headers, writing html responses, and handling http methods like get and post, emphasizing server-side behavior and client-server interactions.', 'chapters': [{'end': 3770.625, 'start': 3509.498, 'title': 'Node.js server and request handling', 'summary': 'Delves into creating a node.js server and working with the request and response objects, showcasing how to access and manipulate request data, including headers, methods, and urls, and introducing the upcoming discussion on sending responses.', 'duration': 261.127, 'highlights': ['The request object generated by Node.js contains various data and functions, including headers, which provide metadata about the request, such as the host, browser details, accepted response types, and cookies, offering valuable insights into the incoming request.', 'Accessing and displaying specific request information, such as the URL, request method, and headers, allows for a focused understanding of the incoming requests, demonstrating the ability to extract pertinent details from the complex request object.', "Understanding the default 'get' method used when entering a URL in a browser and the necessity of quitting and restarting the server after making changes to ensure the updated process is running, provides foundational knowledge for working with Node.js servers and handling requests."]}, {'end': 4356.714, 'start': 3770.625, 'title': 'Sending html response and connecting request and response', 'summary': 'Teaches how to set headers and write html response, connecting request and response, and handling different http methods including get and post, with an emphasis on understanding server-side behavior and client-server interactions.', 'duration': 586.089, 'highlights': ["Setting Headers The lecture explains how to set headers using the 'setHeader' method to specify the content type as HTML, providing insight into supported headers and the importance of understanding server-side behavior.", "Writing HTML Response The process of writing HTML response using the 'write' method is demonstrated, emphasizing the step-by-step approach of composing an HTML document and the significance of calling 'end' to signal the completion of the response.", 'Handling Different HTTP Methods The chapter delves into handling different HTTP methods, particularly focusing on the use of POST request by creating a form in HTML and explaining the behavior and configuration of GET and POST requests.', 'Connecting Request and Response The content emphasizes on connecting request and response by parsing the URL, checking for specific routes, and returning an HTML response, highlighting the importance of understanding server-side responses and client interactions.']}], 'duration': 847.216, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE3509498.jpg', 'highlights': ['Accessing and displaying specific request information, such as the URL, request method, and headers, allows for a focused understanding of the incoming requests, demonstrating the ability to extract pertinent details from the complex request object.', 'The request object generated by Node.js contains various data and functions, including headers, which provide metadata about the request, such as the host, browser details, accepted response types, and cookies, offering valuable insights into the incoming request.', 'Connecting Request and Response The content emphasizes on connecting request and response by parsing the URL, checking for specific routes, and returning an HTML response, highlighting the importance of understanding server-side responses and client interactions.', "Setting Headers The lecture explains how to set headers using the 'setHeader' method to specify the content type as HTML, providing insight into supported headers and the importance of understanding server-side behavior.", 'Handling Different HTTP Methods The chapter delves into handling different HTTP methods, particularly focusing on the use of POST request by creating a form in HTML and explaining the behavior and configuration of GET and POST requests.', "Writing HTML Response The process of writing HTML response using the 'write' method is demonstrated, emphasizing the step-by-step approach of composing an HTML document and the significance of calling 'end' to signal the completion of the response."]}, {'end': 5220.388, 'segs': [{'end': 4418.328, 'src': 'embed', 'start': 4358.054, 'weight': 1, 'content': [{'end': 4364.556, 'text': "With this, let's restart the server by quitting it with control C and restarting it with node app JS.", 'start': 4358.054, 'duration': 6.502}, {'end': 4369.878, 'text': "And let's reload this page on localhost 3000 slash nothing.", 'start': 4365.917, 'duration': 3.961}, {'end': 4376.074, 'text': 'And we see my input and the send button here.', 'start': 4370.738, 'duration': 5.336}, {'end': 4379.788, 'text': "Again, not super pretty, but it's working.", 'start': 4376.966, 'duration': 2.822}, {'end': 4389.693, 'text': "Now let's make sure that if we enter something we had sent, we see this, that we now not only see this, but that something else happens.", 'start': 4380.448, 'duration': 9.245}, {'end': 4399.298, 'text': 'By the way, we do see this because now the URL is slash message, and slash message does not make it into this if statement,', 'start': 4390.073, 'duration': 9.225}, {'end': 4402.4, 'text': 'and therefore this code runs, but we want to do something else.', 'start': 4399.298, 'duration': 3.102}, {'end': 4404.661, 'text': "So let's do that in the next lectures.", 'start': 4402.66, 'duration': 2.001}, {'end': 4418.328, 'text': 'So we made sure that we listened to requests to just slash nothing and that we return some HTML code with our input field on it.', 'start': 4409.437, 'duration': 8.891}], 'summary': "Restarted server, reloaded page, tested input field functionality, and set up request handling for '/nothing'.", 'duration': 60.274, 'max_score': 4358.054, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE4358054.jpg'}, {'end': 4471.405, 'src': 'embed', 'start': 4441.444, 'weight': 0, 'content': [{'end': 4450.408, 'text': "So let's also parse the method from request method and make sure that method is equal to post.", 'start': 4441.444, 'duration': 8.964}, {'end': 4460.297, 'text': "Now we'll only enter this if statement if we have a post request to slash message, which happens to be exactly what we create with this form.", 'start': 4452.33, 'duration': 7.967}, {'end': 4464.642, 'text': 'In this case, I want to do two things.', 'start': 4461.479, 'duration': 3.163}, {'end': 4471.405, 'text': 'I wanna redirect the user back to slash nothing,', 'start': 4465.743, 'duration': 5.662}], 'summary': 'Parse and check for post request to /message, then redirect user back to /nothing.', 'duration': 29.961, 'max_score': 4441.444, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE4441444.jpg'}, {'end': 4546.667, 'src': 'embed', 'start': 4499.079, 'weight': 3, 'content': [{'end': 4505.281, 'text': 'We need another package, another core module, and that was the file system core module.', 'start': 4499.079, 'duration': 6.202}, {'end': 4509.443, 'text': "So let's import it by storing the functionality in a constant.", 'start': 4505.941, 'duration': 3.502}, {'end': 4511.023, 'text': 'You can name it however you want.', 'start': 4509.783, 'duration': 1.24}, {'end': 4519.206, 'text': "I'll name it Fs because the package is named Fs, but you can also name this differently at this, not the package, just the constant.", 'start': 4511.083, 'duration': 8.123}, {'end': 4523.276, 'text': 'So FS allows us to work with the file system.', 'start': 4520.595, 'duration': 2.681}, {'end': 4526.797, 'text': 'And here I now want to write a new file.', 'start': 4523.876, 'duration': 2.921}, {'end': 4533.578, 'text': "So here let's execute write file and write file takes a path to the file.", 'start': 4527.417, 'duration': 6.161}, {'end': 4537.399, 'text': "And I'll just use the file name to create it in the same folder as app.js.", 'start': 4533.638, 'duration': 3.761}, {'end': 4540.34, 'text': "And I'll simply name it message.text.", 'start': 4538.459, 'duration': 1.881}, {'end': 4545.126, 'text': 'And in there, I obviously wanna store what the user sent.', 'start': 4542.065, 'duration': 3.061}, {'end': 4546.667, 'text': 'Now this is a little bit more work.', 'start': 4545.326, 'duration': 1.341}], 'summary': 'Import file system core module, write new file named message.text with user input', 'duration': 47.588, 'max_score': 4499.079, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE4499079.jpg'}, {'end': 4718.444, 'src': 'embed', 'start': 4692.377, 'weight': 4, 'content': [{'end': 4698.62, 'text': "Now, what is such a stream of data, though? There is a connected concept, buffers, and we'll have a look at both here.", 'start': 4692.377, 'duration': 6.243}, {'end': 4701.84, 'text': "So let's take our incoming request as an example.", 'start': 4699.38, 'duration': 2.46}, {'end': 4706.761, 'text': 'There also are other streams like, for example, when working with files, we can also work with streams.', 'start': 4702.14, 'duration': 4.621}, {'end': 4708.782, 'text': "But let's stick to requests here.", 'start': 4707.021, 'duration': 1.761}, {'end': 4712.843, 'text': 'Our stream here is basically an ongoing process.', 'start': 4709.862, 'duration': 2.981}, {'end': 4718.444, 'text': 'The request is simply read by node in chunks, you could say.', 'start': 4713.583, 'duration': 4.861}], 'summary': 'A stream of data is an ongoing process read by node in chunks.', 'duration': 26.067, 'max_score': 4692.377, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE4692377.jpg'}, {'end': 4898.348, 'src': 'embed', 'start': 4863.334, 'weight': 6, 'content': [{'end': 4866.716, 'text': 'Now, on allows us to listen to certain events.', 'start': 4863.334, 'duration': 3.382}, {'end': 4870.778, 'text': 'And the event I want to listen to here is the data event.', 'start': 4867.376, 'duration': 3.402}, {'end': 4876.801, 'text': 'You see my IDE even gives me some help here and tells me which events I can listen to for a request.', 'start': 4871.018, 'duration': 5.783}, {'end': 4879.462, 'text': 'So here I want to listen for the data event.', 'start': 4877.521, 'duration': 1.941}, {'end': 4885.345, 'text': 'The data event will be fired whenever a new chunk is ready to be read.', 'start': 4880.202, 'duration': 5.143}, {'end': 4889.507, 'text': 'You remember that buffer thing? This is basically helping us with that.', 'start': 4885.765, 'duration': 3.742}, {'end': 4898.348, 'text': 'Now here, we have to add a second argument, which is that function that should be executed for every data event.', 'start': 4891.365, 'duration': 6.983}], 'summary': 'Listening for the data event triggers execution for every new chunk, aiding in data processing.', 'duration': 35.014, 'max_score': 4863.334, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE4863334.jpg'}, {'end': 5037.122, 'src': 'embed', 'start': 5007.161, 'weight': 7, 'content': [{'end': 5012.044, 'text': "And we can even log this to see how often it does this and what's inside of this chunk.", 'start': 5007.161, 'duration': 4.883}, {'end': 5018.935, 'text': 'Now we need to register another event listener and that is the end listener.', 'start': 5014.013, 'duration': 4.922}, {'end': 5024.517, 'text': "This will be fired once it's done parsing the incoming request data or the incoming requests in general.", 'start': 5019.215, 'duration': 5.302}, {'end': 5029.319, 'text': 'Here it will again execute a function we define as a second argument.', 'start': 5025.398, 'duration': 3.921}, {'end': 5037.122, 'text': "And in this function, we can now rely on all the chunks being read in and they're all stored in the body now.", 'start': 5029.879, 'duration': 7.243}], 'summary': 'Logging frequency and content of parsing chunks, registering end listener for incoming request data', 'duration': 29.961, 'max_score': 5007.161, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE5007161.jpg'}, {'end': 5104.064, 'src': 'embed', 'start': 5077.56, 'weight': 8, 'content': [{'end': 5082.625, 'text': 'So this will, in the end, create a new buffer and add all the chunks from inside my body to it.', 'start': 5077.56, 'duration': 5.065}, {'end': 5092.389, 'text': 'And then on this buffer, which I got here, parsed body is now a buffer, There, I can call toString to convert it to a string.', 'start': 5083.486, 'duration': 8.903}, {'end': 5097.816, 'text': 'So this is a utility method offered by Node.js where we do something to our buffered chunks.', 'start': 5092.489, 'duration': 5.327}, {'end': 5101.982, 'text': 'Remember, the bus is now waiting and the bus stops, so to say.', 'start': 5098.237, 'duration': 3.745}, {'end': 5104.064, 'text': 'The buffer is our bus stop.', 'start': 5102.262, 'duration': 1.802}], 'summary': 'Node.js utility method for converting buffered chunks to string.', 'duration': 26.504, 'max_score': 5077.56, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE5077560.jpg'}], 'start': 4358.054, 'title': 'Node.js server operations', 'summary': 'Covers server restart, handling post requests, redirecting users, working with file system in node.js including creating new file, setting status code, and explaining streams and buffers, and handling request data including event listeners, data chunks, buffering, and parsing request body.', 'chapters': [{'end': 4471.405, 'start': 4358.054, 'title': 'Server restart and request handling', 'summary': 'Covers restarting the server, handling post requests with specific conditions, and redirecting users back to the homepage after a post request to slash message.', 'duration': 113.351, 'highlights': ['Handling post requests with specific conditions, such as checking the URL and method, is essential for proper request handling and user redirection.', 'Restarting the server by quitting with control C and restarting it with node app JS is a fundamental step in server maintenance and updates.', 'Listening to requests to just slash nothing and returning HTML code with an input field is crucial for creating user-friendly web interfaces.']}, {'end': 4834.685, 'start': 4471.405, 'title': 'Working with file system in node.js', 'summary': 'Covers redirecting user input to create a new file using the file system core module in node.js, including using writefilesync to store user input, setting a status code of 302 for redirection, and explaining the concept of streams and buffers for handling incoming data.', 'duration': 363.28, 'highlights': ['Creating a new file to store user input and using writeFileSync for now The chapter covers creating a new file named message.txt to store user input, utilizing writeFileSync to write the file, and setting a status code of 302 for redirection.', 'Explaining the concept of streams and buffers for handling incoming data The chapter delves into the concept of streams as an ongoing process to read requests in chunks, the use of buffers to organize incoming data chunks, and the advantage of streaming data for handling complex and large requests.', 'Introduction to the File System core module and its functionality The chapter introduces the File System core module in Node.js, which allows working with the file system, and emphasizes the usage of the module to work with files.']}, {'end': 5220.388, 'start': 4835.245, 'title': 'Handling request data in node.js', 'summary': 'Discusses the process of handling request data in node.js, including registering event listeners, working with chunks of data, buffering, and parsing the request body to access and store the input in a file.', 'duration': 385.143, 'highlights': ["Node.js uses event listeners to handle request data, such as the 'data' event that is fired whenever a new chunk is ready to be read. Node.js uses event listeners to handle request data, such as the 'data' event that is fired whenever a new chunk is ready to be read.", "The 'end' event listener is registered to execute a function once all the chunks of data have been read, and then the chunks are buffered and parsed to access and store the input in a file. The 'end' event listener is registered to execute a function once all the chunks of data have been read, and then the chunks are buffered and parsed to access and store the input in a file.", 'The process involves creating a new constant to store the parsed body and using the buffer object to concatenate all the chunks from the body, followed by converting it to a string using the toString method. The process involves creating a new constant to store the parsed body and using the buffer object to concatenate all the chunks from the body, followed by converting it to a string using the toString method.']}], 'duration': 862.334, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE4358054.jpg', 'highlights': ['Handling post requests with specific conditions is essential for proper request handling and user redirection.', 'Restarting the server by quitting with control C and restarting it with node app JS is a fundamental step in server maintenance and updates.', 'Listening to requests to just slash nothing and returning HTML code with an input field is crucial for creating user-friendly web interfaces.', 'Creating a new file named message.txt to store user input, utilizing writeFileSync to write the file, and setting a status code of 302 for redirection.', 'The chapter delves into the concept of streams as an ongoing process to read requests in chunks, the use of buffers to organize incoming data chunks, and the advantage of streaming data for handling complex and large requests.', 'The chapter introduces the File System core module in Node.js, which allows working with the file system, and emphasizes the usage of the module to work with files.', "Node.js uses event listeners to handle request data, such as the 'data' event that is fired whenever a new chunk is ready to be read.", "The 'end' event listener is registered to execute a function once all the chunks of data have been read, and then the chunks are buffered and parsed to access and store the input in a file.", 'The process involves creating a new constant to store the parsed body and using the buffer object to concatenate all the chunks from the body, followed by converting it to a string using the toString method.']}, {'end': 6069.344, 'segs': [{'end': 5328.262, 'src': 'embed', 'start': 5300.094, 'weight': 2, 'content': [{'end': 5304.155, 'text': "We'll later use ExpressJS, which hides all that raw logic.", 'start': 5300.094, 'duration': 4.061}, {'end': 5312.357, 'text': 'But to understand why we use that, you first of all need to understand what is happening and why using tools like ExpressJS,', 'start': 5304.395, 'duration': 7.962}, {'end': 5315.778, 'text': 'which will make all of this much easier, are great.', 'start': 5312.357, 'duration': 3.421}, {'end': 5319.359, 'text': 'So with that, we got our basic logic down.', 'start': 5316.859, 'duration': 2.5}, {'end': 5328.262, 'text': "Let's now dive again into that event listener and writing files thing, because there is something really important you have to understand.", 'start': 5319.76, 'duration': 8.502}], 'summary': 'Using expressjs simplifies logic for better understanding and easier development.', 'duration': 28.168, 'max_score': 5300.094, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE5300094.jpg'}, {'end': 5454.46, 'src': 'embed', 'start': 5421.656, 'weight': 3, 'content': [{'end': 5423.277, 'text': 'which is called asynchronously.', 'start': 5421.656, 'duration': 1.621}, {'end': 5429.702, 'text': "Now, it's not always the case that a passed-in function is necessarily executed at a later point of time,", 'start': 5423.797, 'duration': 5.905}, {'end': 5433.344, 'text': 'but Node.js uses this pattern heavily and throughout the course.', 'start': 5429.702, 'duration': 3.642}, {'end': 5439.029, 'text': "I'll, of course, let you know when this is the case and when Node executes something asynchronously.", 'start': 5433.344, 'duration': 5.685}, {'end': 5446.633, 'text': "In such cases, Node.js won't immediately run that function.", 'start': 5440.908, 'duration': 5.725}, {'end': 5454.46, 'text': 'Instead, what it does when it first encounters this line is it will simply add a new event listener internally.', 'start': 5447.053, 'duration': 7.407}], 'summary': 'Node.js heavily uses the asynchronous pattern throughout the course.', 'duration': 32.804, 'max_score': 5421.656, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE5421656.jpg'}, {'end': 5900.748, 'src': 'embed', 'start': 5875.709, 'weight': 1, 'content': [{'end': 5881.633, 'text': 'You have this event-driven architecture where you basically tell Node.js,', 'start': 5875.709, 'duration': 5.924}, {'end': 5889.759, 'text': 'please do something and it will then go ahead and offload that process to the operating system, which does use multi-threading and so on,', 'start': 5881.633, 'duration': 8.126}, {'end': 5900.748, 'text': 'and will then continue its event loop to listen for event callbacks and always just dispatch tiny actions like that to never block the code execution.', 'start': 5889.759, 'duration': 10.989}], 'summary': 'Node.js uses event-driven architecture to offload processes to the operating system, utilizing multi-threading and event loop to dispatch tiny actions and prevent code execution blocking.', 'duration': 25.039, 'max_score': 5875.709, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE5875709.jpg'}, {'end': 6047.833, 'src': 'embed', 'start': 6022.156, 'weight': 0, 'content': [{'end': 6028.1, 'text': 'Because there is an important concept which you have to understand to understand, well, what is happening behind the scenes.', 'start': 6022.156, 'duration': 5.944}, {'end': 6031.843, 'text': 'So in our Node application, we have our code.', 'start': 6028.921, 'duration': 2.922}, {'end': 6040.529, 'text': 'And one important thing to understand and to really keep in mind is that Node.js uses only one single JavaScript thread.', 'start': 6032.103, 'duration': 8.426}, {'end': 6045.191, 'text': 'A thread is basically like a process in your operating system, you could say.', 'start': 6041.189, 'duration': 4.002}, {'end': 6047.833, 'text': "So it's only using that one thread.", 'start': 6045.691, 'duration': 2.142}], 'summary': 'Node.js uses only one single javascript thread for its application, which is an important concept to understand.', 'duration': 25.677, 'max_score': 6022.156, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE6022156.jpg'}], 'start': 5220.388, 'title': 'Node.js event handling and asynchronous execution', 'summary': 'Discusses event handling in node.js, emphasizing the importance of understanding code execution order, and the implications of asynchronous execution in node.js, highlighting the use of only one single javascript thread to handle multiple requests.', 'chapters': [{'end': 5368.823, 'start': 5220.388, 'title': 'Node.js event handling', 'summary': 'Discusses the correct handling of event listeners and code execution in node.js, emphasizing the importance of understanding the order of code execution and the need to move certain code into event listeners to ensure proper execution, with a plan to later use expressjs to simplify the process.', 'duration': 148.435, 'highlights': ['The importance of understanding the order of code execution is emphasized, with the need to move certain code into event listeners to ensure proper execution.', 'Node.js is described as not waiting and pausing, and it does not block the script execution, rather it registers actions to be executed in the future and continues immediately.', 'The need to understand the raw logic of Node.js is stressed before using tools like ExpressJS, which will make the process much easier, is highlighted.']}, {'end': 6069.344, 'start': 5369.104, 'title': 'Node.js asynchronous execution', 'summary': 'Explains the implications of node.js executing event listeners after sending responses, the asynchronous pattern in node.js, and the importance of not blocking code execution, with the key point that node.js uses only one single javascript thread to handle multiple requests.', 'duration': 700.24, 'highlights': ['Node.js uses a pattern where you pass a function to a function and Node will execute these passed-in functions at a later point of time, called asynchronously. Node.js uses an asynchronous pattern where functions passed as arguments are executed at a later point in time.', 'Node.js has an event-driven architecture and offloads processes to the operating system to handle long taking tasks, ensuring high performance and never blocking code execution. Node.js offloads processes to the operating system and uses an event-driven architecture to ensure high performance and never block code execution.', 'Node.js uses only one single JavaScript thread to handle multiple requests, ensuring the importance of not blocking code execution and understanding the asynchronous nature of Node.js. Node.js uses only one single JavaScript thread to handle multiple requests, emphasizing the importance of not blocking code execution and understanding the asynchronous nature of Node.js.']}], 'duration': 848.956, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE5220388.jpg', 'highlights': ['Node.js uses only one single JavaScript thread to handle multiple requests, ensuring the importance of not blocking code execution and understanding the asynchronous nature of Node.js.', 'Node.js has an event-driven architecture and offloads processes to the operating system to handle long taking tasks, ensuring high performance and never blocking code execution.', 'The need to understand the raw logic of Node.js is stressed before using tools like ExpressJS, which will make the process much easier, is highlighted.', 'Node.js uses a pattern where you pass a function to a function and Node will execute these passed-in functions at a later point of time, called asynchronously.']}, {'end': 6650.149, 'segs': [{'end': 6125.113, 'src': 'embed', 'start': 6094.095, 'weight': 2, 'content': [{'end': 6095.758, 'text': "Now let's start with the performance.", 'start': 6094.095, 'duration': 1.663}, {'end': 6101.692, 'text': "Let's say we have some code which accesses the file system as we already did in this course too.", 'start': 6096.3, 'duration': 5.392}, {'end': 6111.821, 'text': "Now, working with files often is a task that takes longer because files can be very big and it doesn't necessarily complete instantly.", 'start': 6102.853, 'duration': 8.968}, {'end': 6120.189, 'text': "Therefore, if we're doing this upon an incoming request, a second request might have to wait because we're not able to handle it yet,", 'start': 6112.402, 'duration': 7.787}, {'end': 6121.83, 'text': 'or it even gets declined.', 'start': 6120.189, 'duration': 1.641}, {'end': 6125.113, 'text': 'So basically our web page is down for that user.', 'start': 6121.89, 'duration': 3.223}], 'summary': 'File system access can slow performance, causing delays for incoming requests and potentially declining them, leading to downtime for users.', 'duration': 31.018, 'max_score': 6094.095, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE6094095.jpg'}, {'end': 6164.428, 'src': 'embed', 'start': 6137.327, 'weight': 4, 'content': [{'end': 6141.352, 'text': 'Node.js does that when, well, it basically starts running code.', 'start': 6137.327, 'duration': 4.025}, {'end': 6146.516, 'text': 'This is responsible for handling event callbacks, though.', 'start': 6142.433, 'duration': 4.083}, {'end': 6150.819, 'text': 'So all these nice functions we basically added thus far.', 'start': 6146.896, 'duration': 3.923}, {'end': 6159.325, 'text': 'in create server, for example, the event loop is responsible for basically running that code when a certain event occurs.', 'start': 6150.819, 'duration': 8.506}, {'end': 6164.428, 'text': "You could say it's aware of all these callbacks and basically, well, executes that code.", 'start': 6159.345, 'duration': 5.083}], 'summary': 'Node.js handles event callbacks and executes code when events occur.', 'duration': 27.101, 'max_score': 6137.327, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE6137327.jpg'}, {'end': 6219.735, 'src': 'embed', 'start': 6193.556, 'weight': 0, 'content': [{'end': 6200.759, 'text': 'Instead, our file system operation and a couple of other long taking operations are sent to a worker pool,', 'start': 6193.556, 'duration': 7.203}, {'end': 6204.221, 'text': 'which is also spun up and managed by Node.js automatically.', 'start': 6200.759, 'duration': 3.462}, {'end': 6208.783, 'text': 'This worker pool is responsible for all the heavy lifting.', 'start': 6204.941, 'duration': 3.842}, {'end': 6217.953, 'text': 'this worker pool is kind of totally detached of your javascript code, you could say, and it runs on different threads.', 'start': 6209.443, 'duration': 8.51}, {'end': 6219.735, 'text': 'it can spin up multiple threads.', 'start': 6217.953, 'duration': 1.782}], 'summary': 'Node.js automatically manages a worker pool for file system and other long operations, running on different threads and capable of spinning up multiple threads.', 'duration': 26.179, 'max_score': 6193.556, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE6193556.jpg'}, {'end': 6533.77, 'src': 'embed', 'start': 6505.283, 'weight': 1, 'content': [{'end': 6509.707, 'text': "So if you registered any close events and in our code we haven't.", 'start': 6505.283, 'duration': 4.424}, {'end': 6516.352, 'text': 'but if you had any close events, this would be the point of time where Node.js executes their appropriate callbacks.', 'start': 6509.707, 'duration': 6.645}, {'end': 6519.855, 'text': 'So roughly spoken, we have timer callbacks.', 'start': 6516.932, 'duration': 2.923}, {'end': 6528.084, 'text': 'We then have any IO related callbacks and other event callbacks and set immediate followed by close event callbacks.', 'start': 6520.236, 'duration': 7.848}, {'end': 6533.77, 'text': 'So close events are basically handled separately or their callbacks are handled separately, we should say.', 'start': 6528.344, 'duration': 5.426}], 'summary': 'Node.js handles close events separately from other callbacks.', 'duration': 28.487, 'max_score': 6505.283, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE6505283.jpg'}], 'start': 6070.304, 'title': 'Node.js performance and event loop', 'summary': 'Discusses the performance implications of file system access in node.js, highlighting the potential delay due to handling large files, and also explains the event loop in node.js, emphasizing the automatic handling of event callbacks and the use of a worker pool for long-taking operations.', 'chapters': [{'end': 6111.821, 'start': 6070.304, 'title': 'Node.js performance and file access', 'summary': 'Discusses the performance implications of file system access in node.js, highlighting the potential delay due to handling large files and the impact on request handling.', 'duration': 41.517, 'highlights': ['Node.js file system operations can have performance implications due to the potential delay caused by handling large files.', 'The delay in file system operations can impact the handling of multiple requests, potentially affecting the overall performance of the system.']}, {'end': 6650.149, 'start': 6112.402, 'title': 'Node.js event loop', 'summary': 'Explains the event loop in node.js, emphasizing the automatic handling of event callbacks, the use of a worker pool for long-taking operations, and the order in which the event loop executes callbacks.', 'duration': 537.747, 'highlights': ['Node.js event loop is responsible for handling event callbacks and is automatically started when the program begins, avoiding the need for explicit initialization. The event loop in Node.js is automatically started when the program begins and is responsible for handling event callbacks.', 'Long-taking operations in Node.js, such as file system operations, are managed by a worker pool that runs on different threads, detached from the JavaScript code and the event loop. Node.js uses a worker pool to handle long-taking operations like file system operations, running on different threads and detached from the JavaScript code and event loop.', 'The event loop in Node.js has a specific order in which it executes callbacks, starting with timer callbacks, followed by IO-related callbacks, setImmediate callbacks, and close event callbacks. The event loop in Node.js follows a specific order in executing callbacks, beginning with timer callbacks, then IO-related callbacks, setImmediate callbacks, and close event callbacks.']}], 'duration': 579.845, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE6070304.jpg', 'highlights': ['Node.js uses a worker pool to handle long-taking operations like file system operations, running on different threads and detached from the JavaScript code and event loop.', 'The event loop in Node.js follows a specific order in executing callbacks, beginning with timer callbacks, then IO-related callbacks, setImmediate callbacks, and close event callbacks.', 'Node.js file system operations can have performance implications due to the potential delay caused by handling large files.', 'The delay in file system operations can impact the handling of multiple requests, potentially affecting the overall performance of the system.', 'Node.js event loop is responsible for handling event callbacks and is automatically started when the program begins, avoiding the need for explicit initialization.']}, {'end': 7634.644, 'segs': [{'end': 6696.571, 'src': 'embed', 'start': 6651.089, 'weight': 0, 'content': [{'end': 6656.47, 'text': 'Now, I also touched on that security thing with that one JavaScript thread.', 'start': 6651.089, 'duration': 5.381}, {'end': 6661.272, 'text': 'And regarding that, we also got no problems by default,', 'start': 6657.151, 'duration': 4.121}, {'end': 6672.235, 'text': 'though I will come back later to how we can manage global data and how we should manage it to ensure that we do not spoil data from request A to request B.', 'start': 6661.272, 'duration': 10.963}, {'end': 6675.657, 'text': 'By default we have some separation because,', 'start': 6673.095, 'duration': 2.562}, {'end': 6685.023, 'text': "remember that callback method in create server it's executed for every new incoming request and therefore this function only runs for that incoming request,", 'start': 6675.657, 'duration': 9.366}, {'end': 6691.407, 'text': 'and anything we do to the request or response object there will not be exposed to other request or response objects,', 'start': 6685.023, 'duration': 6.384}, {'end': 6696.571, 'text': 'because each function is only scoped to itself and not accessible by the other functions.', 'start': 6691.407, 'duration': 5.164}], 'summary': 'Default security measures ensure data separation between requests in javascript thread.', 'duration': 45.482, 'max_score': 6651.089, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE6651089.jpg'}, {'end': 6753.494, 'src': 'embed', 'start': 6726.092, 'weight': 4, 'content': [{'end': 6732.656, 'text': 'We got all this code in this file and actually typically you write multiple or work with multiple files.', 'start': 6726.092, 'duration': 6.564}, {'end': 6744.025, 'text': "and why don't we create a new file that actually contains our routing logic, so the logic where we check the url and do different things?", 'start': 6733.596, 'duration': 10.429}, {'end': 6746.127, 'text': "so i'll create a new file here.", 'start': 6744.025, 'duration': 2.102}, {'end': 6750.651, 'text': 'routes.js. the name is up to you and i get this special icon.', 'start': 6746.127, 'duration': 4.524}, {'end': 6753.494, 'text': 'by my ide it is a normal javascript file.', 'start': 6750.651, 'duration': 2.843}], 'summary': 'Creating a new file routes.js for routing logic in javascript.', 'duration': 27.402, 'max_score': 6726.092, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE6726092.jpg'}, {'end': 7368.52, 'src': 'embed', 'start': 7342.717, 'weight': 5, 'content': [{'end': 7347.36, 'text': 'can be something different and sends it back to the client, the browser, which then can display that.', 'start': 7342.717, 'duration': 4.643}, {'end': 7350.362, 'text': 'And that is the entire flow we also saw in this module.', 'start': 7347.56, 'duration': 2.802}, {'end': 7353.804, 'text': 'Now, Node.js is the part that runs on the server.', 'start': 7351.38, 'duration': 2.424}, {'end': 7360.353, 'text': 'And regarding its lifecycle, there is one important concept, and that is that so-called event loop.', 'start': 7354.625, 'duration': 5.728}, {'end': 7368.52, 'text': 'Node.js code runs in a non-blocking way, which means we only register a bunch of callbacks and events,', 'start': 7361.596, 'duration': 6.924}], 'summary': 'Node.js runs non-blocking code with an event loop on the server.', 'duration': 25.803, 'max_score': 7342.717, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE7342717.jpg'}, {'end': 7525.682, 'src': 'embed', 'start': 7496.493, 'weight': 6, 'content': [{'end': 7499.694, 'text': 'that is what i mean and that is what is important to keep in mind here.', 'start': 7496.493, 'duration': 3.201}, {'end': 7506.091, 'text': 'We also learned that Node.js is all about using its built-in functionalities.', 'start': 7501.308, 'duration': 4.783}, {'end': 7515.036, 'text': 'And whilst there are some global variables or objects or functions we can use, this also means that we should use its core modules.', 'start': 7506.651, 'duration': 8.385}, {'end': 7520.539, 'text': 'Core modules are things like the HTTP, the FS, or the PATH module.', 'start': 7515.836, 'duration': 4.703}, {'end': 7525.682, 'text': 'There are more, and you can learn all about them in the official Node.js docs, of course.', 'start': 7520.819, 'duration': 4.863}], 'summary': 'Node.js emphasizes using core modules like http, fs, and path for built-in functionalities and best practices.', 'duration': 29.189, 'max_score': 7496.493, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE7496493.jpg'}, {'end': 7634.644, 'src': 'embed', 'start': 7589.259, 'weight': 3, 'content': [{'end': 7599.107, 'text': 'We do export with the help of module dot exports or for multiple exports with the export shortcut I showed you in the last lectures.', 'start': 7589.259, 'duration': 9.848}, {'end': 7602.19, 'text': 'So this is what we learned in this module.', 'start': 7600.067, 'duration': 2.123}, {'end': 7608.136, 'text': 'And I know that this was a lot of theory or nitty gritty stuff about Node.js.', 'start': 7602.49, 'duration': 5.646}, {'end': 7612.981, 'text': "Doesn't look too easy and beautiful, but it'll get way more beautiful from now on.", 'start': 7608.476, 'duration': 4.505}, {'end': 7618.187, 'text': 'It is super important to never forget what Node.js is and does for you though.', 'start': 7613.602, 'duration': 4.585}, {'end': 7624.613, 'text': 'because many courses right away start with ExpressJS, which will all use starting soon.', 'start': 7618.627, 'duration': 5.986}, {'end': 7632.882, 'text': "And therefore you never really learn what's happening under the hood, which is sad because this is important and makes you a better node developer.", 'start': 7625.114, 'duration': 7.768}, {'end': 7634.644, 'text': "With that, let's move on.", 'start': 7633.282, 'duration': 1.362}], 'summary': 'Module covers exports in node.js, emphasizes importance for better understanding under the hood.', 'duration': 45.385, 'max_score': 7589.259, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE7589259.jpg'}], 'start': 6651.089, 'title': 'Javascript and node.js fundamentals', 'summary': 'Covers javascript security features, data separation, and global data management, and explains node.js module system for file organization, routing logic, and server functionality, along with node.js fundamentals like request flow, event loop, non-blocking code, core module usage, and prerequisites for expressjs.', 'chapters': [{'end': 6696.571, 'start': 6651.089, 'title': 'Javascript security management', 'summary': 'Explains the default security features of javascript threads, emphasizing the separation of data for different requests, and discusses how to manage global data to prevent data interference between requests.', 'duration': 45.482, 'highlights': ['The callback method in create server is executed for every new incoming request, ensuring that each function is only scoped to itself and not accessible by other functions.', 'Default separation of data for different requests prevents exposure of request or response objects to other requests.', 'Discussion on managing global data to prevent data interference between requests.']}, {'end': 7315.331, 'start': 6696.891, 'title': 'Node.js module system', 'summary': 'Explains how to connect and export multiple files in node.js using the module system, including creating a separate file for routing logic and exporting functions and text, resulting in a more organized code structure and server functionality.', 'duration': 618.44, 'highlights': ['The chapter explains how to connect and export multiple files in Node.js using the module system. It covers the process of organizing code into multiple files and specifically focuses on connecting and exporting files using the module system in Node.js.', 'Creating a separate file for routing logic and exporting functions and text results in a more organized code structure and server functionality. The transcript demonstrates the creation of a separate file for routing logic, moving code from the main file to the routes file, and exporting functions and text, leading to a more structured codebase and improved server functionality.']}, {'end': 7634.644, 'start': 7316.368, 'title': 'Node.js fundamentals', 'summary': 'Covers the fundamentals of node.js, including the flow of requests and responses, event loop, non-blocking code with callbacks, usage of core modules, and the importance of understanding node.js before using expressjs.', 'duration': 318.276, 'highlights': ['Node.js runs on the server, handling the flow of requests and responses, with the event loop being a crucial concept for non-blocking code execution. Node.js involves non-blocking code execution with the event loop, ensuring efficient handling of incoming requests and events.', 'Understanding the usage of core modules such as HTTP, FS, and PATH is crucial for Node.js development. The utilization of core modules like HTTP, FS, and PATH is essential for various server-related functionalities in Node.js.', 'Emphasizing the importance of comprehending Node.js fundamentals before utilizing ExpressJS for a better understanding of server-side operations. Highlighting the significance of grasping Node.js fundamentals before transitioning to ExpressJS for improved knowledge of server-side operations.']}], 'duration': 983.555, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/C7TFgfY7JdE/pics/C7TFgfY7JdE6651089.jpg', 'highlights': ['The callback method in create server is executed for every new incoming request, ensuring that each function is only scoped to itself and not accessible by other functions.', 'Default separation of data for different requests prevents exposure of request or response objects to other requests.', 'Discussion on managing global data to prevent data interference between requests.', 'The chapter explains how to connect and export multiple files in Node.js using the module system. It covers the process of organizing code into multiple files and specifically focuses on connecting and exporting files using the module system in Node.js.', 'Creating a separate file for routing logic and exporting functions and text results in a more organized code structure and server functionality.', 'Node.js runs on the server, handling the flow of requests and responses, with the event loop being a crucial concept for non-blocking code execution.', 'Understanding the usage of core modules such as HTTP, FS, and PATH is crucial for Node.js development.', 'Emphasizing the importance of comprehending Node.js fundamentals before utilizing ExpressJS for a better understanding of server-side operations.']}], 'highlights': ['Node.js extends JavaScript to run on servers and any machine, adding features like working with the local file system, effectively making it a great choice for building web applications that run on servers.', 'Node.js uses V8, the JavaScript engine built by Google, to compile JavaScript code to machine code, thus enabling the execution of JavaScript outside the browser.', 'Node.js allows executing JavaScript code locally without a browser, enabling access to local file system and server-side code execution.', 'Node.js is utilized for server-side tasks such as connecting to databases, user authentication, and handling business logic.', 'Node.js plays a crucial role in handling incoming requests, parsing them, and sending back responses in web server development.', 'Node.js serves as the code to handle incoming requests, perform user input validation, and communicate with the database, ultimately sending responses to the client.', 'Node.js uses an event loop to keep the server running and handle multiple incoming requests efficiently.', 'Accessing and displaying specific request information, such as the URL, request method, and headers, allows for a focused understanding of the incoming requests, demonstrating the ability to extract pertinent details from the complex request object.', 'Node.js uses only one single JavaScript thread to handle multiple requests, ensuring the importance of not blocking code execution and understanding the asynchronous nature of Node.js.', 'Node.js uses a worker pool to handle long-taking operations like file system operations, running on different threads and detached from the JavaScript code and event loop.', 'The event loop in Node.js follows a specific order in executing callbacks, beginning with timer callbacks, then IO-related callbacks, setImmediate callbacks, and close event callbacks.', 'The callback method in create server is executed for every new incoming request, ensuring that each function is only scoped to itself and not accessible by other functions.', 'Default separation of data for different requests prevents exposure of request or response objects to other requests.', 'Discussion on managing global data to prevent data interference between requests.', 'The chapter explains how to connect and export multiple files in Node.js using the module system. It covers the process of organizing code into multiple files and specifically focuses on connecting and exporting files using the module system in Node.js.']}