Loading
Lesson 11
Courses / Build a Web App like Twitter from Scratch Using HTML, CSS, JavaScript, Express, MySQL
Installing Nodejs using NVM to Start the Development of the Server API

Video Transcript

Welcome back to our lesson. Let's keep going building our web app. So we have come to a point where we can start working on the backend. That's the server side. So far we have done client-side programming. We have implemented the front-end using HTML, CSS, and JavaScript. We have a working prototype, a working draft using fake data with Laura Impson. However, when we add a new entry and reload the page, that data is all gone because it does not get persisted. Normally, when you submit some data to a site, it should call upon a server, send that data to the server. The server, in turn, will store that data in a database. Now, we are going to handle that part with the server side and the database. For the server side, you could use any programming language you want, but for this lesson, for this course, I will be using Node.js. Let's go to the Node.js website. Node.js.org is the website. Node.js is pretty much JavaScript on the server side. It's just an alternative name, but it's just JavaScript, after all. There are many ways to install Node.js depending on your operating system and how you go about it. One way is to go to the website and it provides you with an installer for each operating system. If you use Linux, you may also install Node.js through your package manager. For example, I use Ubuntu. If I try to run Node, it says, okay, that command does not exist, but you can surely install it with APT install Node.js in the studio. Other distributions might have different package managers, but the concept is the same. Now there's yet another way to install Node.js, and that's the way I suggest you. That's through the Node version manager. Let's go to the Node version manager website. This is the Node version manager website. Here's the URL if you want to go there. It's called NVM. If you scroll down here to the instructions, it tells you how to install it. NVM is nice because it allows you to install multiple versions of Node in your machine. While if you download it for the website of your package manager, it will install only a specific version of Node. If you want to switch to a different version of Node.js, then you can't do it. Node version manager allows you to conveniently choose between the Node versions. You can have multiple versions in your machine. This is what I recommend. For Linux and Mac, I recommend NVM. If you use Windows, I recommend NVM Windows. It's a different program from the one. It's the NVM-Windows. Anyway, here's the instructions for installing on Linux. You just need to download the install script that's in this URL. To download it, you can use program like curl or wget. Then you got executed in the terminal. My case is bash. If you use the latest Mac Catalina, you're probably going to use the z shell. Anyway, I have wget, so I'm going to copy and paste this command. I'm going to go to my terminal and paste that. The command is wget. This is the URL to get the script file. We are doing some options to jabberget. It gets that. Then we're going to execute it and type it to bash, mainly execute this script using bash. It's going to install the versions under the directory.nvm. It's a hidden directory under your home directory. In my case, this is for Linux. It's going to be there. The process is done. Now it's asking me to close and reopen a terminal. Start using NVM or run the following. Run it now. The thing is, it adds some code to the terminal profile.file. In my case, it's .bashrc under my home directory. It should have added this. For me to use our node right now, I would have to source that file or reopen a new terminal window. Let's see. If I open a new terminal window and I say node, space-v, it's still not there. So what's going on? Let's see. I'm going to check if I have which profiles I have. ls-al-h-soared-hidden-files-l-enlisted. I'm going to type to grab so I can search for file that starts bash. I have my bash rc right. I can do that. tilde slash dot bash rc. Tilde means the my home directory. I hear my bash rc. Let's go to the end of the file. Should I add an nvmdir here? And it should have worked. I don't know why it didn't work. Let's see. I'm going to source that file. bash rc. Let's try node-v again. And I did not find it. I wonder why. Go back here. Let me close my terminal and reopen everything again. Still does not find it. Thought nvm should be here. Oh, I get it. We got nvm, but it didn't install any version of node yet. So nvm is the manager, but we don't have any version of node yet. I should say nvm install. If I want the latest long-term support version, I think I can do nvm install-dash-lts. There you go. So nvm install-dash-lts. Install the latest long-term support version. If you want a specific version, you can instead type the number of the version there. Now when I say nvm list, I should have the current version pointed here with version 12.18.0, long-term support. If I say node-v, it finally works and tells me the version. Also, I should get nvm now, which is the node package manager. Version 6, 14, 4. We are all good here. So with that, we have installed node version manager and we have installed node, the latest long-term support, as of the date of recording this lesson. This case version 12. So I'll see you in the next lesson.
No comments yet (loading...)
No comments yet (loading...)
Did you like the lesson? 😆👍
Consider a donation to support our work: