
Join the Conversation!
Subscribing gives you access to the comments so you can share your ideas, ask questions, and connect with others.
"Please login to view comments"
Subscribing gives you access to the comments so you can share your ideas, ask questions, and connect with others.
By logging in, you'll unlock full access to this and other free tutorials on JSM Pro.
Why? Logging in lets us personalize your learning experience, track your progress, and keep you in the loop with new workshops, coding tips, and platform updates.
You'll also be the first to know about upcoming launches, events, and exclusive discounts.
No spam—just helpful content to level up your skills.
If that sounds fair, go ahead and log in to continue →
Enter your name and email to get instant access
##Looks like we found a thief monkey By the way, I liked the trick how you reached till here. You have a good sense of humor. You will improve a lot if you join our course with this passion.
var
(function-scoped, outdated)let
(block-scoped, modern and recommended)const
(block-scoped, cannot be reassigned)_
, or $
let let = 5;
is invalid)myVar
and myvar
are different)string
, number
, boolean
, null
, undefined
, bigint
, symbol
Objects
, Arrays
, Functions
Subscribing gives you access to a brief, insightful summary of each lecture to stay on track.
00:00:00 And finally, we are ready to host our API on our VPS.
00:00:04 If you followed along at the start, when I was just starting to create the API, I led you through the process of getting your own virtual private server.
00:00:12 The cheapest plan will be more than enough, so you can choose it, and enter your JavaScript Mastery coupon code, as this will give you an additional discount.
00:00:20 So, if you haven't yet gotten it, you can get it now, or if you already got it, we can continue from the dashboard.
00:00:26 Once you're in, you should be able to find an onboarding for your VPS.
00:00:30 If you can't see it, don't worry, you'll still be able to set up everything from your dashboard.
00:00:34 Choose the location that is closest to you.
00:00:37 No need to get this additional malware scanner.
00:00:39 Here, you'll have to create your secure root password.
00:00:43 You can click here to auto-generate it, but then make sure to copy it and save it somewhere safe, such as in our .env.development,
00:00:51 where we can say vps, and here I can enter my password, as well as the name, which is root, and then click Continue.
00:01:01 And since we have chosen the Node.js VPS, it comes with the latest version of Ubuntu, as well as Node.js pre-installed.
00:01:08 So, let's finish the setup.
00:01:10 This'll take a couple of minutes, so feel free to pause this video, and I'll be right back.
00:01:15 There we go, this was quicker than I anticipated.
00:01:18 Let's also somewhere securely store this SSH access by copying it, and then heading over into our .env, and just pasting it right here as a comment.
00:01:27 And then head over to Manage VPS.
00:01:29 Now, in case you somehow missed the onboarding, that's totally okay because you can change your password right here and you have your SSH terminal here.
00:01:38 And then if you want to change your operating system or settings, it is all here on the left.
00:01:43 Now, what you could do is use a regular terminal, like iTerm, Bash, or PowerShell, but Hostinger also prepared this very nice browser terminal.
00:01:53 So you can just click here, and you're in there.
00:01:56 Once the terminal opens, you'll be able to see some information about your system, and it's gonna ask you about your domain.
00:02:02 For the time being, just simply press Ctrl C, and that'll exit out of the setup, and then clear it.
00:02:09 And then I'll zoom it in so we can see it a bit better.
00:02:11 It looks like we're already within our system.
00:02:13 How do I know that?
00:02:15 Well, that's because if I type something like mkdir, and then the name, something like folder, and then press ls, you'll see that a new folder was created.
00:02:25 And now I can delete it using rm-rf folder.
00:02:30 And now, LS, nothing is there.
00:02:32 So you have a complete access to another PC right within your terminal.
00:02:37 In case you don't want to use Hostinger's built-in terminal, you can open up any kind of terminal on your device.
00:02:43 But how do you get from this terminal into that device?
00:02:45 Well, you can copy this SSH root, paste it in, you can say, yes, I want to connect to it, and then you'll have to enter the password.
00:02:55 Thankfully, we have it here, so just copy it, paste it, and press Enter, and you're in.
00:03:03 Now, you can once again press Ctrl C, and you're within the system.
00:03:08 Either way is fine, but I'll be using the terminal built into the browser.
00:03:12 Now, first things first, as a recommended practice, we want to update all of our packages installed on our VPS computer.
00:03:19 And you can do that by running apt update and apt upgrade y.
00:03:26 This command will update all the packages, and it'll also upgrade all the packages on a Debian-based system, and the Y flag automatically confirms the upgrade.
00:03:37 This could take about a minute, but it's good to know that all of our packages will be updated and upgraded.
00:03:44 So, let's wait until it finishes, and I'll be right back.
00:03:47 There we go.
00:03:48 That seems to have been successful.
00:03:50 So, let's clear it.
00:03:52 And now, since we'll be developing a Node.js application, let's install it by running apt install node.js.
00:04:00 If we're using Bun or Deno, you would install it here.
00:04:04 But thankfully in our case, this VPS already came in with the latest version of Node.js installed.
00:04:09 So we're good, and we can verify it by running node-v.
00:04:14 If you get any kind of number here, you're good.
00:04:17 And for some reason, this Node.js installation does not come with the respective npm package manager, so let's install it separately by running apt install npm.
00:04:29 Now, it looks like there are some problems, but let's just check whether we have a version of npm install by running npm-v.
00:04:37 And we do get it.
00:04:38 That means we're good.
00:04:40 But in addition to the node manager, we also need a system-wide process manager that'll ensure that our tasks continue running even after crashes or reboots
00:04:50 and automatically restart them in the background on our VPS server in case of failure.
00:04:55 There's an npm package that we can install for that called pm2.
00:05:00 So just run npm install –g pm2.
00:05:04 There we go.
00:05:06 And on top of that, we'll also need a Git system installed so we can easily transfer our codebase from our local device to GitHub and then to the VPS.
00:05:16 While there are other methods, I found Git to be the simplest, especially for updating the API even after making changes.
00:05:23 To install it, simply run apt install git-y.
00:05:28 Super simple.
00:05:29 Now, head over to GitHub and create a new repo.
00:05:33 You can call it however your API is called.
00:05:36 In this case, I'll say something like subscription tracker.
00:05:40 and I'll click create repo.
00:05:42 Then open up your terminal and run git init git add dot git commit dash m initial commit git branch m main and then copy this git remote add origin as
00:06:06 well as git push u-origin-main.
00:06:09 In a matter of a second, the entire codebase will be pushed to main, and then you'll have to grab this link so we can clone it over to our VPS machine.
00:06:18 So, back in our VPS terminal, you can now say git clone, and you can paste the URL you just copied.
00:06:24 It'll clone it, and then you can press LS.
00:06:28 LS stands for List, and it's a command that simply lists files and directories in the current directory in your operating system.
00:06:36 Since we don't have a visual graphical user interface, we use it to see available files and folders.
00:06:43 Here, you can see the folder we created.
00:06:47 Now, we have to set up a couple of things inside of it.
00:06:50 So, to navigate inside of that folder in a Unix-based system, we can use the CD command.
00:06:57 CD stands for Change Directory, and it's used to navigate between different directories.
00:07:02 You can just start typing and then press Enter, and it'll actually autofill the entire name.
00:07:08 And press Enter, and now we can see the path has changed, and we're officially within the subscription tracker.
00:07:16 So now, if you press LS, you can see all the files and folders we worked so hard to create.
00:07:22 Once you verify that you're in, you'll have to run npm install to install all of the dependencies, this time within our VPS.
00:07:31 And the next couple of steps are tough, and they're gonna depend on the operating system you chose, and there's a lot of things that can break.
00:07:38 So I don't wanna just record it and make it work for me, but then it's possible that it won't work for you.
00:07:44 That wouldn't be a good video.
00:07:45 So for that reason, I decided to create a completely free VPS hosting and debugging guide.
00:07:51 where I'll list all the steps one by one with debugging instructions, so if something goes wrong, you can easily fix it.
00:07:59 I'll link it somewhere below this lesson or in the GitHub Readme of this repo.
00:08:02 You'll be able to follow along and finish it there.
00:08:04 But with that in mind, this was a huge course, so pat yourself on the back because you built your own API.
00:08:11 But as I said, we're not finishing here.
00:08:13 In the free guide that'll always be up to date, you can finish this course and deploy this API to a VPS so it becomes publicly and globally accessible.
00:08:23 Thank you so much for watching and I'll see you in the next one.
00:08:26 Until then, have a wonderful day.