Transcript from the "Nodejs Refresher" Lesson
>> Speaker 1: So let's just hop right into it then. Everybody should have the link for this. These are going to be our notes, or our slides. I don't like to use actual slides, I'm just worn out on slides, so I just made a website, with the notes on it and that's what we're gonna use, and this will be here forever, probably at the center README on the GitHub.
[00:00:59] README so you can look at it. So this is where we'll do our learnings and then we'll have an app that we'll be building and then, as far as the app, the repo is gonna be here. If you haven't got this go ahead and fork it or clone it or whatever your process is for getting your repos.
[00:01:17] Cool, so also I want to let you all know to, if you have a question here on site, just ask me, don't feel like you have to wait until the end. Just, I want to stay open. Ask me as many questions as you want, don't feel like you are slowing me down and online, if you're joining us, just hit up Mark with a K on the channel and just ask him and he will either answer it himself or he'll ask me so just feel free to ask as many questions as you can.
[00:01:43] If you think I made a mistake or if you didn't quite understand what I said, don't let it go by, just totally ask me. Great, so what are we gonna be doing for these next three days in this workshop? Well, like I said it's gonna be around designing APIs with Node and Mongo, and how all that works.
[00:02:03] So, not only are we gonna be learning how to design this stuff but we're also gonna be building it of course. We're gonna learn how to test it and we're gonna be deploying it, which makes sense. It wouldn't really be fair if I showed you how to design an API and not how to do the rest of that stuff.
[00:02:55] So as far as the application itself, you will not be building that. You actually built that on another workshop. So that's built for you, the front end, the client. You'll just be building the server part for it. So don't worry about messing around with the actual web app.
[00:03:08] We already built an app. Cool. Any questions so far? All right. So, let's just do a quick refresher on Node. Who in here has experience with Node? Let me see your hands. Okay. A little bit, a little bit, none, okay. So we're gonna do a little bit of a refresher on it.
[00:03:48] That's what Nodejs is, is using the same V8 that Google Chrome is using. Or I mean, it's actually, Node is using a different version of V8 but it is V8. So we can use Node for many things now, like tooling and servers, because we can run it outside the context of the browser.
>> Speaker 1: All right.
[00:05:14] I can't come into Node and start doing things I would expect in a browser, yeah, let me just do a document.query selector. Right, that's not gonna work.
[00:05:39] There are some that are there that are very useful, like Console, that's still there, Console.log, Console dot, all that good stuff, all that's still there, but a lot of the other stuff isn't, so just remember that. Yes.
>> Speaker 2: A question came up, is there a way to add the browser APIs to Nodejs?
[00:06:17] You wouldn't need it for execution. You might need it for a library to work. For instance, I had to tell somebody the other day, there's this animation library that we use that's expecting these window, or these browser APIs to exist. And if it don't it'll error out on Node.
[00:06:58] So that's the newer way to build your libraries. So that's the thing that people are starting to do now. If you download something that isn't like that, something that's attached to the window, and you try to run it in Node, probably gonna get an error. So you can chase the errors and figure out the polyfill yourself or just convert it to Node yourself and see what happens.
[00:07:17] But, yeah, there are some polyfills that do exist, but people are moving away from that.
>> Speaker 1: So, if you were to install Node, you will also notice that you get something called NPM which, if you look at it, you might think it stands for Node Package Manager but it actually doesn't.
[00:07:36] It doesn't stand for Node Package Manager. I actually don't even know what it stands for. So [LAUGH] it's not Node Package Manager though. I think it's a pun that the NPM people came up with, but it's not Node Package Manager, which should be it. So, NPM is actually a really, really good package manager though, as far as handling dependencies.
[00:08:08] So the way NPM works, like I said, it comes bundled with your installation of Node. It uses this file called a package.json to store meta data about your packages and what packages your package may need. So it just reads that file depending on the command you give it.
[00:08:24] And that's how it knows what to install, what do uninstall, what to update. It's just a file. So NPM is the standard. There really aren't any other package managers you would use with Node. But they are two separate entities. NPM is its own entity, Node is its own entity.
[00:08:41] They just happen to be working together because they just work that way. So, yeah, you'll see a lot of, everything that we do as far as dependency management will be through NPM. There are other package managers out there like Bower and stuff like that. But Bower is a Node module that you have to install with NPM.
[00:08:58] And that's more for client site dependencies. So it's still all through NPM. So, all third party modules when downloaded will be placed in a node modules directory by default. So we use NPM to go download something. If there isn't already a node modules directed at the root of our application, one will be created.
[00:09:17] And that's where all of our node modules will be placed by default, in a node modules folder.