YouTube2Text

Node.js Crash Course Tutorial #1 - Introduction & Setup — Transcript

by Net Ninja · 2,887 words · 390 segments · language en · Watch on YouTube

Full transcript

  1. 0:00hey gang and welcome to your very first
  2. 0:01step in becoming a node ninja a rather
  3. 0:10than gang now I do already have a node
  4. 0:12tutorial on this channel but I wanted to
  5. 0:15update it because now that's about four
  6. 0:17or five years old so I wanted to do a
  7. 0:20quick refresh a nice new node tutorial
  8. 0:22because in the future I'm going to
  9. 0:24create some more advanced node tutorials
  10. 0:27as well and then I can direct people to
  11. 0:29this more recent playlist to learn the
  12. 0:32basics first of all okay there so first
  13. 0:34things first what is node j/s well as
  14. 0:38developers when we're creating websites
  15. 0:40we normally talk about code on either
  16. 0:42the front end inside browser or back end
  17. 0:45code or server-side code which is the
  18. 0:47code which runs on a server now
  19. 0:49javascript is normally confined to run
  20. 0:52in a browser in the past on the front
  21. 0:54end and we'd use it to do things like
  22. 0:56add interactivity to a web page like
  23. 0:58click events or things like that now we
  24. 1:00never used to be able to run JavaScript
  25. 1:03directly on a computer or server but
  26. 1:06node allows us to run JavaScript on the
  27. 1:09server side as well or even directly on
  28. 1:11computers now before you explain any
  29. 1:14more about that first of all I want to
  30. 1:16talk a little bit about how computers
  31. 1:18actually understand code so computers
  32. 1:21really only understand machine code but
  33. 1:24that is really complex to write and a
  34. 1:27read
  35. 1:27it's like binary like this so something
  36. 1:30called assembly language is built on top
  37. 1:33of that which is a bit easier to read
  38. 1:35and write which is then assembled down
  39. 1:38into machine code so the computer can
  40. 1:40still understand it but this right here
  41. 1:43this assembler language is still overly
  42. 1:45complex to read and write so built on
  43. 1:47top of that we have programming
  44. 1:49languages like C++ which are abstracted
  45. 1:51a lot away from assembly code and
  46. 1:54they're much easier to read and write so
  47. 1:58ultimately this C++ code is then
  48. 2:01compiled down to machine code so
  49. 2:05therefore we can write C++ code on a
  50. 2:07computer and a computer will understand
  51. 2:09it because it's being compiled down to
  52. 2:11machine code now
  53. 2:13javascript is a language which is
  54. 2:15abstracted even more away from machine
  55. 2:17code than C++ to make programming easier
  56. 2:20still but computers cannot directly
  57. 2:23understand JavaScript or compile it down
  58. 2:25to machine code so we cannot directly
  59. 2:27run JavaScript on a computer right but
  60. 2:31it can run inside a browser so how does
  61. 2:33that work well running inside browsers
  62. 2:36is an engine called the v8 engine and
  63. 2:38the v8 engine is written in C++ by
  64. 2:42Google and it compiles JavaScript into
  65. 2:44machine code at runtime so bypassing
  66. 2:47JavaScript code through this v8 engine
  67. 2:50in the browser the computer can then
  68. 2:52understand JavaScript within the context
  69. 2:55of that browser however it cannot run
  70. 2:58JavaScript outside the browser because
  71. 3:00there is no v8 engine compiling it down
  72. 3:02outside the browser it's confined to the
  73. 3:05browser only but that is where node
  74. 3:07comes into play so node.js is a program
  75. 3:11also written in C++ and that wraps the
  76. 3:15v8 engine so this v8 engine that's in
  77. 3:18browsers also lives inside node as well
  78. 3:21now because node is written in C++ it
  79. 3:26can run directly on our computer so by
  80. 3:29installing and running node on our
  81. 3:31computer it can take our JavaScript it
  82. 3:34can run it through the v8 compiler that
  83. 3:36it has inside it and it compiles our
  84. 3:38JavaScript into machine code so that in
  85. 3:41essence we can now run JavaScript
  86. 3:43directly on a computer or server and not
  87. 3:46just in a browser but node is more than
  88. 3:51just a wrapper for the v8 engine
  89. 3:53it also hooks into the v8 engines and
  90. 3:55more functionality to JavaScript so that
  91. 3:58when we are using nodes a compile and
  92. 4:00run JavaScript we can use all of this
  93. 4:02extra functionality in our JavaScript
  94. 4:04code and that kind of functionality
  95. 4:05includes things like the ability to read
  96. 4:08and write files on a computer or to
  97. 4:11connect to a database the ability to act
  98. 4:13as a server for content these are all
  99. 4:16the kind of things you'd expect a
  100. 4:17server-side language to do and now we
  101. 4:19can do them with JavaScript running
  102. 4:22through node now remember javascript was
  103. 4:24originally made for the brow
  104. 4:26to add interactivity and not to run
  105. 4:29directly on computers or service so
  106. 4:32normally it can't do all of this stuff
  107. 4:34but with the help of node it can but on
  108. 4:36the flip side since we're now using node
  109. 4:38to run JavaScript outside the browser we
  110. 4:41lose access to JavaScript features such
  111. 4:43as the document object model we can't
  112. 4:45interact with HTML elements anymore but
  113. 4:48we don't really need to do that when
  114. 4:50we're running JavaScript on a server and
  115. 4:51acting as a back-end to our website
  116. 4:54right so just going back to computers
  117. 4:57and machine code node now plugs into the
  118. 5:00top of this stack with the v8 engine so
  119. 5:04that now we can write JavaScript code on
  120. 5:06a computer which is then compiled down
  121. 5:08into machine code forests so that
  122. 5:11computers can now understand JavaScript
  123. 5:14and that is freaking awesome
  124. 5:19so then now we've got a bird's-eye view
  125. 5:21of what node actually does for us what
  126. 5:24would we actually use it for well the
  127. 5:27role of node in a website is basically
  128. 5:29to run JavaScript on the back end or
  129. 5:31server side and then we're going to be
  130. 5:32handling requests coming in from a
  131. 5:35browser so for example a user might
  132. 5:37visit your website in a browser now that
  133. 5:39browser is going to make a request to
  134. 5:41the server the node server is going to
  135. 5:43run some kind of JavaScript you'll react
  136. 5:45to the request and it might communicate
  137. 5:48maybe with a database or files on the
  138. 5:50server then it's going to formulate some
  139. 5:52kind of response and send it right back
  140. 5:55to the browser now that response could
  141. 5:58be an HTML page with dynamic data
  142. 6:00embedded inside it or maybe some CSS and
  143. 6:03image files etc so basically the note
  144. 6:06server is running JavaScript on the back
  145. 6:09end to do all of this so using node in a
  146. 6:12website is pretty much an alternative
  147. 6:14now to or the server-side languages like
  148. 6:16Python Ruby PHP etc but the rad benefits
  149. 6:20of using node over the others first of
  150. 6:23all if you're already familiar with
  151. 6:25JavaScript then there's absolutely no
  152. 6:27need to learn a new server-side language
  153. 6:29because node is going to be taking
  154. 6:31javascript and compiling it down so we
  155. 6:33can use the same language on the front
  156. 6:35end and the back end and to that end we
  157. 6:38can also share cold for front end and
  158. 6:41the back end since they both use
  159. 6:43JavaScript it's very popular and it's
  160. 6:45got a massive massive community around
  161. 6:48it so there's always help if you need it
  162. 6:50and there's also a huge amount of
  163. 6:52third-party packages and tools to help
  164. 6:55with web development and we're going to
  165. 6:57see some of those as we go through this
  166. 6:59course
  167. 7:03I rather than so in this course we're
  168. 7:05gonna go from the absolute beginning and
  169. 7:07to begin with I'm going to show you how
  170. 7:09to install node and use it to run
  171. 7:11JavaScript on your computer or in a
  172. 7:13server then we're going to see how to
  173. 7:15use know to read and write files on your
  174. 7:17computer we'll also see how to create a
  175. 7:20server and then make a website using
  176. 7:22node by listing for and responding to
  177. 7:24HTTP requests then we're going to dive
  178. 7:26right into third party packages in
  179. 7:29particular Express to create an express
  180. 7:32up and that is a very very easy way and
  181. 7:35a very popular way to build node
  182. 7:37websites then we're going to introduce
  183. 7:39databases in particular
  184. 7:41MongoDB which is a no sequel database
  185. 7:44and we're going to use that to store
  186. 7:46data and then create dynamic web pages
  187. 7:48and to that end as well we will be using
  188. 7:51template engines ejs in particular to
  189. 7:54inject dynamic content into our HTML
  190. 7:56templates which we can then send back to
  191. 7:59the browser finally we're going to put
  192. 8:01everything together that we learn to
  193. 8:03make a node powered website project so
  194. 8:07this is the little project we're going
  195. 8:08to create it's a very simple blog
  196. 8:11website where we can list all of the
  197. 8:13current blogs we can click on one to see
  198. 8:15more information we can also go to add a
  199. 8:18new blog and I'll just call this one
  200. 8:20Mario Party and add in some ninja tips
  201. 8:24as you do like so and then click on
  202. 8:28submit and we can see that new blog at
  203. 8:30the top over here we can also delete
  204. 8:32blogs by clicking on this little Delete
  205. 8:34icon right here and we have an about
  206. 8:37page as well which every block needs so
  207. 8:40this is the project we're going to be
  208. 8:43creating using node Express and also
  209. 8:46MongoDB as the database as well
  210. 8:48throughout this series now before we
  211. 8:52start I want to make one thing crystal
  212. 8:54clear this is not a beginner Java Script
  213. 8:57course and you should already know the
  214. 8:59foundations of the JavaScript language
  215. 9:01things like functions how asynchronous
  216. 9:04code works all that kind of just and
  217. 9:06ideal it you should also know a little
  218. 9:09bit about HTML and CSS too since at the
  219. 9:11end of the day we are making a website
  220. 9:13and there will be HTML and CSS involve
  221. 9:17now I've got courses on both of these
  222. 9:19things on this channel and on udemy I've
  223. 9:22got a modern JavaScript course and also
  224. 9:25an HTML and the CSS crash course as well
  225. 9:27so the links to both of these are going
  226. 9:29to be a highlight down below
  227. 9:35a rather than gang so the first step in
  228. 9:38all this is to install node on your
  229. 9:41computer now it might be that you
  230. 9:43already have node installed on your
  231. 9:45computer but you're just unaware of it
  232. 9:47so in order to check that open up a
  233. 9:50terminal I'm going to use command prompt
  234. 9:53by typing CMD and pressing enter and
  235. 9:55then in here type node space hyphen V
  236. 9:58and if you have node installed it should
  237. 10:01give you back a version number you can
  238. 10:03see mine is version 14 point 1.0 now if
  239. 10:08you don't get a version number it means
  240. 10:09you don't have node installed and you're
  241. 10:12gonna have to go ahead and install it
  242. 10:14likewise you might get a different
  243. 10:16number a smaller number which means you
  244. 10:18have an older version of node in which
  245. 10:21case you might want to update as well so
  246. 10:23in order to do that to install it or
  247. 10:26update it go to node.js org
  248. 10:28this link will be down below and then
  249. 10:30click on this button right here to
  250. 10:32install the latest version that's going
  251. 10:34to download an installer run that when
  252. 10:36it's done and the install wizard will
  253. 10:39install node on your computer for you it
  254. 10:41only takes a couple of minutes
  255. 10:43now once you've done that I would
  256. 10:45suggest closing your terminal opening it
  257. 10:47up again and typing in node - V just to
  258. 10:51make sure you get a version number and
  259. 10:53it's installed correctly so now you have
  260. 10:56node installed on your computer we can
  261. 10:58use it to run JavaScript directly on our
  262. 11:01computer and we could even do that
  263. 11:03directly inside this terminal so to do
  264. 11:06that I'm gonna type node and then enter
  265. 11:08and that starts the node process and
  266. 11:10right now we see a blinking cursor and
  267. 11:12that's asking us to basically type some
  268. 11:15JavaScript to run through node so now I
  269. 11:17could write something like 5 plus 5
  270. 11:19press ENTER and we get back 10 that's
  271. 11:22valid JavaScript right and we could
  272. 11:24write any JavaScript code that we want
  273. 11:25to write here so I could say var name is
  274. 11:28equal to Mario and then type name and we
  275. 11:32get back and Mario so any kind of valid
  276. 11:35JavaScript we can write inside this
  277. 11:37terminal but ideally we don't want to
  278. 11:40write code in a terminal all the time
  279. 11:42it's going to be really tough to create
  280. 11:43a website this way so instead we're
  281. 11:46going to need a good text editor to work
  282. 11:48in now I'm going to be
  283. 11:50using vs code of Visual Studio code
  284. 11:52which is a great free text editor and
  285. 11:55you can get it from code dot visual
  286. 11:57studio comm and click on this download
  287. 11:59button right here for Mac or for Windows
  288. 12:01but you don't have to use this you can
  289. 12:03use your own favorite like sublime or
  290. 12:05atom if you prefer but at the minute I
  291. 12:07would recommend this one it's a really
  292. 12:09nice text editor so anyway once you have
  293. 12:12your text editor installed open it up
  294. 12:15and maybe start a new project folder in
  295. 12:18that text editor I'm actually going to
  296. 12:20do that from the command line over here
  297. 12:22so let me exit this process by clicking
  298. 12:25ctrl C twice and that exits out of the
  299. 12:29node process then I'm going to navigate
  300. 12:32to a folder where I want to create my
  301. 12:34new project so I'm going to say CD which
  302. 12:37stands for change directory to dive into
  303. 12:39a folder called documents that I have on
  304. 12:43my computer then CD again to go into
  305. 12:45another folder I created called totes
  306. 12:46and then right here I'm going to create
  307. 12:48a new directory by saying mkdir that
  308. 12:52stands for make directory and I'm going
  309. 12:54to call this node - crash - course and
  310. 12:58then I'm going to see the into that so
  311. 13:01see the node - crash - course and then
  312. 13:05I'm going to open up this particular
  313. 13:07directory inside of the S code now to
  314. 13:10open that up from the command line in vs
  315. 13:13code I can say code dot and that means
  316. 13:17open up visual studio code in the
  317. 13:19current directory alright so press ENTER
  318. 13:22and that should hopefully open up visual
  319. 13:25studio code in this project directory we
  320. 13:28can see that right here in node crash
  321. 13:29course ok
  322. 13:33so then now we have our text editor open
  323. 13:36let's just give this a whirl what I'm
  324. 13:39gonna do is create a new file over here
  325. 13:41and I'm gonna call this test dot J s and
  326. 13:45inside you I'm just gonna write some
  327. 13:47basic JavaScript code so I'm going to
  328. 13:49say Const and then we'll say name is
  329. 13:51equal to Mario right and all I'm gonna
  330. 13:55do is console dot log name so I've got a
  331. 14:00JavaScript file now on my computer how
  332. 14:02do I run this JavaScript file well I can
  333. 14:05do that through the terminal so I'm
  334. 14:07going to go to terminal at the top and
  335. 14:09then go to new terminal and make sure
  336. 14:11you're in the correct directory where
  337. 14:14the file exists where you made that file
  338. 14:16and then type node and then the file
  339. 14:20name so in our case test now you don't
  340. 14:23need to add the JavaScript extension
  341. 14:25because it knows we're going to run a
  342. 14:27JavaScript file so I can just say node
  343. 14:30test which is the name of the file press
  344. 14:32ENTER and it runs that file for us on
  345. 14:35our computer and we actually see down
  346. 14:37here in the terminal which is acting as
  347. 14:39the console for us this name Mario okay
  348. 14:42so it run the file it logged this to the
  349. 14:45terminal or the console down here so let
  350. 14:48me try this again I'm going to change
  351. 14:50this to something else like not your paw
  352. 14:53but Yoshi and save that now I have
  353. 14:56to run this file again for it to work so
  354. 14:58down here I can just press up to do the
  355. 15:01latest command I wrote and press ENTER
  356. 15:03again node test and now we can see Yoshi
  357. 15:06right here so we could write any
  358. 15:09JavaScript inside this file then run it
  359. 15:11and if we're logging things to the
  360. 15:13console we're gonna see them down here
  361. 15:14inside the terminal and that's how easy
  362. 15:17it is to run a javascript file on our
  363. 15:20computer using node this is not being
  364. 15:23run inside a browser anywhere now it's
  365. 15:25being run directly on our computer now
  366. 15:29finally going i've created course files
  367. 15:32for every single lesson in this tutorial
  368. 15:34series and they're all found on this
  369. 15:37give repo right here node crash course
  370. 15:39now don't worry if you don't know how to
  371. 15:42use git or github or anything like that
  372. 15:44you don't really need to know how to to
  373. 15:46see the code or down
  374. 15:47load the code I'll leave this link down
  375. 15:49below but essentially each lesson in
  376. 15:52this series is going to have its own
  377. 15:54branch in this github repo so we can see
  378. 15:57the branches right here and if you want
  379. 15:59to see the code for lesson 4 for example
  380. 16:02you could go to the lesson for branch
  381. 16:03and you're gonna see all of the code
  382. 16:05right here and all of the different
  383. 16:07files now if you want to download this
  384. 16:10you can go to close or download if
  385. 16:12you're familiar with github and get you
  386. 16:14can clone the repo to your local machine
  387. 16:17or if you want to download a zip file
  388. 16:19with all of this code in you can do by
  389. 16:22clicking download zip or right here
  390. 16:30[Music]

About this transcript

This page contains the full transcript of Node.js Crash Course Tutorial #1 - Introduction & Setup by Net Ninja, generated from the public captions YouTube serves with the video. The transcript has 2,887 words across 390 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.