<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>nodejs Archives - ServerStadium</title>
	<atom:link href="https://serverstadium.com/knowledge-base/tag/nodejs/feed/" rel="self" type="application/rss+xml" />
	<link>https://serverstadium.com/knowledge-base/tag/nodejs/</link>
	<description>Public Cloud Solution by ServerStadium</description>
	<lastBuildDate>Sat, 08 Mar 2025 02:35:50 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.4</generator>

<image>
	<url>https://serverstadium.com/wp-content/uploads/2023/04/cropped-favicon-1-32x32.png</url>
	<title>nodejs Archives - ServerStadium</title>
	<link>https://serverstadium.com/knowledge-base/tag/nodejs/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Monitor Your Services Uptime Using Uptime Kuma</title>
		<link>https://serverstadium.com/knowledge-base/monitor-your-services-uptime-using-uptime-kuma/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Mon, 04 Apr 2022 15:35:09 +0000</pubDate>
				<guid isPermaLink="false">https://cloudraya.com/knowledge-base/?p=1748</guid>

					<description><![CDATA[<p>Uptime Kuma is a feature-rich yet simple to use uptime monitoring tool. It will allow you to monitor your servers and services uptime and also notify you in case of downtime. TLDR (Too Long Didn&#8217;t Read!) Docker approach: Non-docker approach: Step-by-Step Installation Guide Installing, or rather, deploying Uptime Kuma using Docker is the easiest method&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/monitor-your-services-uptime-using-uptime-kuma/">Monitor Your Services Uptime Using Uptime Kuma</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Uptime Kuma is a feature-rich yet simple to use uptime monitoring tool. It will allow you to monitor your servers and services uptime and also notify you in case of downtime.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img fetchpriority="high" decoding="async" width="1290" height="595" src="https://serverstadium.com/wp-content/uploads/2022/04/image-13.png" alt="" class="wp-image-1964" style="width:968px;height:446px" srcset="https://serverstadium.com/wp-content/uploads/2022/04/image-13.png 1290w, https://serverstadium.com/wp-content/uploads/2022/04/image-13-300x138.png 300w, https://serverstadium.com/wp-content/uploads/2022/04/image-13-1024x472.png 1024w, https://serverstadium.com/wp-content/uploads/2022/04/image-13-768x354.png 768w" sizes="(max-width: 1290px) 100vw, 1290px" /><figcaption class="wp-element-caption">Uptime Kuma main dashboard</figcaption></figure>
</div>


<h2 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">TLDR (Too Long Didn&#8217;t Read!)</h2>



<p class="wp-block-paragraph">Docker approach:</p>



<pre class="wp-block-code"><code># Install Docker CE

docker volume create uptime-kuma

docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1</code></pre>



<p class="wp-block-paragraph">Non-docker approach:</p>



<pre class="wp-block-code"><code># Install nodejs and npm

# Update npm
sudo npm install npm -g

git clone https://github.com/louislam/uptime-kuma.git
cd uptime-kuma
npm run setup

sudo npm install -g pm2
pm2 start server/server.js --name uptime-kuma
</code></pre>



<h2 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">Step-by-Step Installation Guide</h2>



<p class="wp-block-paragraph">Installing, or rather, deploying Uptime Kuma using Docker is the easiest method as you won&#8217;t need to take care of extra dependency. Just run the crafted docker CLI command, and you&#8217;re all set!</p>



<p class="wp-block-paragraph">But I will also explain how to deploy it using NodeJS plus PM2! So, you can choose which method fits you.</p>



<h3 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">Prerequisites</h3>



<p class="wp-block-paragraph">For both approaches, allow port 3001 from your OS firewall and/or your active ServerStadium Security Profile.</p>



<h3 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">Via Docker</h3>



<h4 class="wp-block-heading has-vivid-cyan-blue-color has-text-color"><strong>Step 1:</strong></h4>



<p class="wp-block-paragraph">Install docker of course! You can follow the guide <a href="https://serverstadium.com/knowledge-base/how-to-deploy-container-in-serverstadium-using-docker/" target="_blank" rel="noreferrer noopener">here</a>.</p>



<h4 class="wp-block-heading has-vivid-cyan-blue-color has-text-color"><strong>Step 2:</strong></h4>



<p class="wp-block-paragraph">Create a docker volume to ensure persistent data</p>



<pre class="wp-block-code"><code>docker volume create uptime-kuma</code></pre>



<h4 class="wp-block-heading has-vivid-cyan-blue-color has-text-color"><strong>Step 3:</strong></h4>



<p class="wp-block-paragraph">Run <strong>uptime-kuma</strong></p>



<pre class="wp-block-code"><code>docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1</code></pre>



<h4 class="wp-block-heading has-vivid-cyan-blue-color has-text-color"><strong>Step 4: </strong></h4>



<p class="wp-block-paragraph">Make sure uptime-kuma is running!</p>



<pre class="wp-block-code"><code>docker ps</code></pre>



<h4 class="wp-block-heading has-vivid-cyan-blue-color has-text-color"><strong>Step 5:</strong></h4>



<p class="wp-block-paragraph">Proceed to the <a href="#First-time-setup" rel="nofollow">First setup section</a>!</p>



<h3 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">Non-docker deployment</h3>



<p class="wp-block-paragraph">Uptime Kuma requires nodejs version &gt;= 14, git and npm.</p>



<h4 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">Step 1: Installing nodejs package</h4>



<h5 class="wp-block-heading">For RHEL/CentOS/Alma/Rocky 8</h5>



<p class="wp-block-paragraph">Check dnf module for nodejs</p>



<pre class="wp-block-code"><code>sudo dnf module list nodejs</code></pre>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" src="https://serverstadium.com/wp-content/uploads/2021/12/image-13.png" alt="" class="wp-image-1756"/><figcaption class="wp-element-caption">nodejs module list</figcaption></figure>
</div>


<p class="wp-block-paragraph">In this article, I will install version 16:</p>



<pre class="wp-block-code"><code>sudo dnf module install nodejs:16</code></pre>



<h5 class="wp-block-heading">For Ubuntu 20.04</h5>



<p class="wp-block-paragraph">Pull the NodeSource PPA. If you wish to install another version, replace the &#8220;16&#8221; below with any version you want to install:</p>



<pre class="wp-block-code"><code>curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh</code></pre>



<p class="wp-block-paragraph">Then, execute the script:</p>



<pre class="wp-block-code"><code>sudo bash nodesource_setup.sh</code></pre>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img decoding="async" width="799" height="432" src="https://serverstadium.com/wp-content/uploads/2022/02/image-3.png" alt="" class="wp-image-1861" style="width:599px;height:324px" srcset="https://serverstadium.com/wp-content/uploads/2022/02/image-3.png 799w, https://serverstadium.com/wp-content/uploads/2022/02/image-3-300x162.png 300w, https://serverstadium.com/wp-content/uploads/2022/02/image-3-768x415.png 768w" sizes="(max-width: 799px) 100vw, 799px" /><figcaption class="wp-element-caption">NodeSource PPA</figcaption></figure>
</div>


<p class="wp-block-paragraph">Lastly, install <strong>nodejs</strong></p>



<pre class="wp-block-code"><code>sudo apt install nodejs -y</code></pre>



<h4 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">Step 2: Building Uptime Kuma</h4>



<p class="wp-block-paragraph">This part and beyond would work for whichever Linux distro you&#8217;re using.</p>



<p class="wp-block-paragraph">Pull Uptime Kuma repo and then enter the cloned directory:</p>



<pre class="wp-block-code"><code>git clone https://github.com/louislam/uptime-kuma.git
cd uptime-kuma</code></pre>



<p class="wp-block-paragraph">After that, run the following command to start building Uptime Kuma:</p>



<pre class="wp-block-code"><code>npm run setup</code></pre>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="567" height="407" src="https://serverstadium.com/wp-content/uploads/2021/12/image-14.png" alt="" class="wp-image-1757" srcset="https://serverstadium.com/wp-content/uploads/2021/12/image-14.png 567w, https://serverstadium.com/wp-content/uploads/2021/12/image-14-300x215.png 300w" sizes="(max-width: 567px) 100vw, 567px" /><figcaption class="wp-element-caption">Setting up Uptime Kuma</figcaption></figure>
</div>


<p class="wp-block-paragraph">Once it&#8217;s done, test it!</p>



<pre class="wp-block-code"><code>node server/server.js</code></pre>



<p class="wp-block-paragraph">If it outputs something like this, then the setup is good.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" src="https://serverstadium.com/wp-content/uploads/2021/12/image-15.png" alt="" class="wp-image-1758"/><figcaption class="wp-element-caption">Running Uptime Kuma</figcaption></figure>
</div>


<p class="wp-block-paragraph">Exit it by pressing CTRL+C. Next, we will run it with <code>pm2</code> so it would run in the background.</p>



<h4 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">Step 3: Setup pm2</h4>



<p class="wp-block-paragraph">Install the PM2 module via npm</p>



<pre class="wp-block-code"><code>sudo npm install -g pm2</code></pre>



<p class="wp-block-paragraph">Then, run the following command. Make sure you run it in the uptime-kuma directory:</p>



<pre class="wp-block-code"><code>pm2 start server/server.js --name uptime-kuma</code></pre>



<p class="wp-block-paragraph">Check if it&#8217;s running well in the background by <code>pm2 status</code> command:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="1014" height="100" src="https://serverstadium.com/wp-content/uploads/2021/12/image-16.png" alt="" class="wp-image-1760" style="width:761px;height:75px" srcset="https://serverstadium.com/wp-content/uploads/2021/12/image-16.png 1014w, https://serverstadium.com/wp-content/uploads/2021/12/image-16-300x30.png 300w, https://serverstadium.com/wp-content/uploads/2021/12/image-16-768x76.png 768w" sizes="(max-width: 1014px) 100vw, 1014px" /><figcaption class="wp-element-caption">Running Uptime Kuma using PM2</figcaption></figure>
</div>


<h2 class="wp-block-heading has-vivid-cyan-blue-color has-text-color" id="First-time-setup">First time setup</h2>



<p class="wp-block-paragraph">Yay, now it&#8217;s ready! Access your Uptime Kuma via http://YOUR-IP:3001</p>



<blockquote class="wp-block-quote is-style-default is-layout-flow wp-block-quote-is-layout-flow">
<p class="wp-block-paragraph">The URL looks ugly, right? If you want to get rid of it and use SSL to make it more secure, use a reverse proxy. You can read <a href="https://serverstadium.com/knowledge-base/reverse-proxy-management-using-nginx-proxy-manager/">this article</a> on how to use Nginx Proxy Manager to manage this kind of hassle easily.</p>
</blockquote>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img decoding="async" src="https://serverstadium.com/wp-content/uploads/2021/12/image-17.png" alt="" class="wp-image-1761" style="width:676px;height:510px"/><figcaption class="wp-element-caption">First-time accessing Uptime Kuma</figcaption></figure>
</div>


<p class="wp-block-paragraph">Create your admin user with a strong and complicated password. Then you&#8217;ll be brought to this page:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="1072" height="652" src="https://serverstadium.com/wp-content/uploads/2021/12/image-18.png" alt="" class="wp-image-1763" style="width:536px;height:326px" srcset="https://serverstadium.com/wp-content/uploads/2021/12/image-18.png 1072w, https://serverstadium.com/wp-content/uploads/2021/12/image-18-300x182.png 300w, https://serverstadium.com/wp-content/uploads/2021/12/image-18-1024x623.png 1024w, https://serverstadium.com/wp-content/uploads/2021/12/image-18-768x467.png 768w" sizes="(max-width: 1072px) 100vw, 1072px" /><figcaption class="wp-element-caption">Dashboard</figcaption></figure>
</div>


<p class="wp-block-paragraph">Proceed to the next section!</p>



<h2 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">Adding monitor</h2>



<p class="wp-block-paragraph">Uptime Kuma supports various types of monitoring. Here, I will cover most of them.</p>



<h3 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">Basic HTTP(s)</h3>



<p class="wp-block-paragraph">Basic HTTP/HTTPS monitoring, as the title describes it, monitors basic HTTP/HTTPS connection. Uptime Kuma simply tries to reach the designated website, and it will report if it&#8217;s reachable and the latency.</p>



<p class="wp-block-paragraph"><strong>Step 1.</strong> On the dashboard, click Add New Monitor</p>



<p class="wp-block-paragraph"><strong>Step 2. </strong>Select HTTP(s) for the monitor type.</p>



<p class="wp-block-paragraph"><strong>Step 3.</strong> Give it a friendly name, e.g. My Blog Website</p>



<p class="wp-block-paragraph"><strong>Step 4.</strong> Specify the URL</p>



<p class="wp-block-paragraph"><strong>Step 5.</strong> Set the checking interval.</p>



<p class="wp-block-paragraph"><strong>Step 6.</strong> Set the number of retries before Uptime Kuma sends a notification/alert.</p>



<p class="wp-block-paragraph"><strong>Step 7.</strong> Set the retry check interval. When a monitor is reported down, this interval will override the previous checking interval.</p>



<p class="wp-block-paragraph"><strong>Last step.</strong> Save!</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="606" height="632" src="https://serverstadium.com/wp-content/uploads/2022/01/image-24.png" alt="" class="wp-image-1831" style="width:455px;height:474px" srcset="https://serverstadium.com/wp-content/uploads/2022/01/image-24.png 606w, https://serverstadium.com/wp-content/uploads/2022/01/image-24-288x300.png 288w" sizes="(max-width: 606px) 100vw, 606px" /><figcaption class="wp-element-caption">Basic HTTP(s) monitor</figcaption></figure>
</div>


<p class="wp-block-paragraph">In the <strong>Advanced </strong>section, an option allows you to flip the status. So, when the website is reachable, then it&#8217;s considered DOWN and will be alerted. Also, you can set the maximum redirects. Lastly, specify the status code it should return and consider it UP.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img decoding="async" src="https://serverstadium.com/wp-content/uploads/2022/01/image-25.png" alt="" class="wp-image-1832" style="width:462px;height:237px"/><figcaption class="wp-element-caption">Monitor status</figcaption></figure>
</div>


<h3 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">HTTP(s) keyword</h3>



<p class="wp-block-paragraph">Keyword monitoring will monitor a web page and find a specific keyword, not the HTTP service itself. When the keyword is not present, then the website is considered DOWN. This will allow you to quickly notice if your website is being defaced, hacked, or if something unexpected happens to the page.</p>



<p class="wp-block-paragraph">The steps are similar to the previous one, but you&#8217;ll need to specify which keyword should be present on the webpage/site.</p>



<p class="wp-block-paragraph">For example, on the ServerStadium KB page, the footer has a text which says &#8220;Wow Technologies, Inc. Company&#8221; and we want to monitor that.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img decoding="async" src="https://serverstadium.com/wp-content/uploads/2022/04/image-9.png" alt="" class="wp-image-1955" style="width:603px;height:363px"/><figcaption class="wp-element-caption">The Keyword!</figcaption></figure>
</div>


<p class="wp-block-paragraph">The configurations are as follows:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="857" height="665" src="https://serverstadium.com/wp-content/uploads/2022/04/image-11.png" alt="" class="wp-image-1958" style="width:643px;height:499px" srcset="https://serverstadium.com/wp-content/uploads/2022/04/image-11.png 857w, https://serverstadium.com/wp-content/uploads/2022/04/image-11-300x233.png 300w, https://serverstadium.com/wp-content/uploads/2022/04/image-11-768x596.png 768w" sizes="(max-width: 857px) 100vw, 857px" /><figcaption class="wp-element-caption">Setting HTTP(s) Keyword Monitoring</figcaption></figure>
</div>


<p class="wp-block-paragraph">Then if you click Save, a green notification will pop up and says that the keyword is found! And the monitor states UP.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="857" height="665" src="https://serverstadium.com/wp-content/uploads/2022/04/image-10.png" alt="" class="wp-image-1956" srcset="https://serverstadium.com/wp-content/uploads/2022/04/image-10.png 857w, https://serverstadium.com/wp-content/uploads/2022/04/image-10-300x233.png 300w, https://serverstadium.com/wp-content/uploads/2022/04/image-10-768x596.png 768w" sizes="(max-width: 857px) 100vw, 857px" /><figcaption class="wp-element-caption">The Keyword is found!</figcaption></figure>
</div>


<h3 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">TCP port</h3>



<p class="wp-block-paragraph">This will monitor a specific port from a given server. Good use of this will be to monitor if certain services are down. For example, you will know that your SMTP service is down when the designated port is no longer open to the public, or any management ports or anything, you name it.</p>



<p class="wp-block-paragraph">Follow the steps from the Basic HTTP monitoring part until step 3. Then fill in the Hostname field with the desired server and the port with the TCP port to be monitored.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img decoding="async" src="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_22-19.jpg" alt="" class="wp-image-1998" style="width:311px;height:455px"/><figcaption class="wp-element-caption">TCP port monitoring</figcaption></figure>
</div>


<h3 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">Ping</h3>



<p class="wp-block-paragraph">Self-explanatory, it will monitor the host by sending it ping probes. The simplest monitoring types. You&#8217;ll only need to fill in the server host/IP.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="1290" height="595" src="https://serverstadium.com/wp-content/uploads/2022/04/image-12.png" alt="" class="wp-image-1959" style="width:317px;height:401px" srcset="https://serverstadium.com/wp-content/uploads/2022/04/image-12.png 1290w, https://serverstadium.com/wp-content/uploads/2022/04/image-12-300x138.png 300w, https://serverstadium.com/wp-content/uploads/2022/04/image-12-1024x472.png 1024w, https://serverstadium.com/wp-content/uploads/2022/04/image-12-768x354.png 768w" sizes="(max-width: 1290px) 100vw, 1290px" /><figcaption class="wp-element-caption">Ping monitoring</figcaption></figure>
</div>


<h3 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">DNS record</h3>



<p class="wp-block-paragraph">DNS monitoring allows you to monitor a given DNS record. Whether it&#8217;s A, MX, CNAME, TXT, or any record type, you can quickly take action if your DNS records are no longer propagated, somehow.</p>



<p class="wp-block-paragraph"><strong>Step 1. </strong>Set the monitoring type to DNS</p>



<p class="wp-block-paragraph"><strong>Step 2.</strong> Always specify a friendly name.</p>



<p class="wp-block-paragraph"><strong>Step 3.</strong> Specify the hostname. E.g. google.com</p>



<p class="wp-block-paragraph"><strong>Step 4.</strong> Specify the resolver address. You can choose any DNS server, e.g. Cloudflare&#8217;s 1.1.1.1 or Google&#8217;s 8.8.8.8</p>



<p class="wp-block-paragraph"><strong>Step 5.</strong> Specify which DNS record you want to monitor.</p>



<p class="wp-block-paragraph">And the rest would be the same as the other monitoring types.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img decoding="async" src="https://serverstadium.com/wp-content/uploads/2022/04/image-12.png" alt="" class="wp-image-1962" style="width:317px;height:401px"/><figcaption class="wp-element-caption">DNS record monitoring</figcaption></figure>
</div>


<h3 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">Push monitoring</h3>



<p class="wp-block-paragraph">You can monitor any servers that aren&#8217;t reachable from the internet but can reach the internet. Servers behind NAT, or having outgoing internet access only using a proxy for instance.</p>



<p class="wp-block-paragraph">Simply put the Push URL in a cron job on a minute basis, and you&#8217;re all set.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="860" height="660" src="https://serverstadium.com/wp-content/uploads/2022/04/image-14.png" alt="" class="wp-image-1965" style="width:317px;height:428px" srcset="https://serverstadium.com/wp-content/uploads/2022/04/image-14.png 860w, https://serverstadium.com/wp-content/uploads/2022/04/image-14-300x230.png 300w, https://serverstadium.com/wp-content/uploads/2022/04/image-14-768x589.png 768w" sizes="(max-width: 860px) 100vw, 860px" /><figcaption class="wp-element-caption">Push monitoring</figcaption></figure>
</div>


<p class="wp-block-paragraph">Cronjob example:</p>



<pre class="wp-block-code"><code>* * * * * /usr/bin/curl -s 'http://HOSTNAME:3001/api/push/RGjeIGaV9p?msg=OK&amp;ping='</code></pre>



<h2 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">Setting up notifications</h2>



<p class="wp-block-paragraph">Uptime Kuma supports a variety of notification types. But here, I will explain only email and telegram notifications.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="411" height="196" src="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_22-08.jpg" alt="" class="wp-image-1992" srcset="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_22-08.jpg 411w, https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_22-08-300x143.jpg 300w" sizes="(max-width: 411px) 100vw, 411px" /><figcaption class="wp-element-caption">Create a new notification</figcaption></figure>
</div>


<h3 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">Email</h3>



<p class="wp-block-paragraph">Email notification setup is pretty straightforward. You&#8217;ll only need to set up SMTP credentials, like when connecting with a mail client.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="519" height="672" src="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-04.jpg" alt="" class="wp-image-1974" style="width:389px;height:504px" srcset="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-04.jpg 519w, https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-04-232x300.jpg 232w" sizes="(max-width: 519px) 100vw, 519px" /><figcaption class="wp-element-caption">SMTP settings</figcaption></figure>
</div>


<p class="wp-block-paragraph">After filling in the required information, press the test button to check if the credentials are correct:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img decoding="async" src="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-04_1.jpg" alt="" class="wp-image-1975" style="width:383px;height:512px"/><figcaption class="wp-element-caption">Email connection test</figcaption></figure>
</div>


<p class="wp-block-paragraph">It will show a green notification box in the corner if Uptime Kuma can connect</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="342" height="83" src="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-04_2.jpg" alt="" class="wp-image-1976" srcset="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-04_2.jpg 342w, https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-04_2-300x73.jpg 300w" sizes="(max-width: 342px) 100vw, 342px" /><figcaption class="wp-element-caption">Test email success</figcaption></figure>
</div>


<p class="wp-block-paragraph">Otherwise, it will throw an error and explain why it fails to connect. Next, check your mailbox for the test email.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="559" height="144" src="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-09.jpg" alt="" class="wp-image-1977" srcset="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-09.jpg 559w, https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-09-300x77.jpg 300w" sizes="(max-width: 559px) 100vw, 559px" /><figcaption class="wp-element-caption">Test email is received</figcaption></figure>
</div>


<p class="wp-block-paragraph">Then, try to make a fake downtime by setting an invalid hostname/port (or any parameter) so it will send an alert.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="860" height="660" src="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-25.jpg" alt="" class="wp-image-1979" style="width:645px;height:495px" srcset="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-25.jpg 860w, https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-25-300x230.jpg 300w, https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-25-768x589.jpg 768w" sizes="(max-width: 860px) 100vw, 860px" /><figcaption class="wp-element-caption">Faking a downtime</figcaption></figure>
</div>


<p class="wp-block-paragraph">Check your mailbox; you should receive an alert for it!</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="502" height="361" src="https://serverstadium.com/wp-content/uploads/2022/04/image-15.png" alt="" class="wp-image-1980" srcset="https://serverstadium.com/wp-content/uploads/2022/04/image-15.png 502w, https://serverstadium.com/wp-content/uploads/2022/04/image-15-300x216.png 300w" sizes="(max-width: 502px) 100vw, 502px" /><figcaption class="wp-element-caption">Down alert sent</figcaption></figure>
</div>


<p class="wp-block-paragraph">Tada!</p>



<h3 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">Telegram</h3>



<p class="wp-block-paragraph">Telegram notification setup will require you to prepare the following elements:</p>



<ol class="wp-block-list">
<li>Creating a Telegram BOT</li>



<li>Direct Chat/Group/Channel Chat ID</li>
</ol>



<h4 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">Creating a Telegram BOT</h4>



<p class="wp-block-paragraph">Open your Telegram app (Mobile or PC), and search for @botfather. Be careful of any fake botfather accounts; make sure it&#8217;s exactly @botfather and has a verified icon on the name.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="281" height="130" src="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-37.jpg" alt="" class="wp-image-1983"/><figcaption class="wp-element-caption">The real botfather bot account.</figcaption></figure>
</div>


<p class="wp-block-paragraph">Then add the bot and start creating a bot.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="443" height="256" src="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-42.jpg" alt="" class="wp-image-1985" srcset="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-42.jpg 443w, https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-42-300x173.jpg 300w" sizes="(max-width: 443px) 100vw, 443px" /><figcaption class="wp-element-caption">Creating a telegram bot</figcaption></figure>
</div>


<p class="wp-block-paragraph">In the end, the BotFather will give you the API token you will use in Uptime Kuma. Keep it safe, and don&#8217;t share it with anybody.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="450" height="277" src="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-44.jpg" alt="" class="wp-image-1987" srcset="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-44.jpg 450w, https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-44-300x185.jpg 300w" sizes="(max-width: 450px) 100vw, 450px" /><figcaption class="wp-element-caption">BOT API token</figcaption></figure>
</div>


<p class="wp-block-paragraph">The first part is done; let&#8217;s go to the second one.</p>



<h4 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">Obtaining the Chat ID</h4>



<p class="wp-block-paragraph">A chat ID is the ID of a direct chat or channel or group where you want Uptime Kuma to send the notification. To get this ID, you&#8217;ll need to determine whether you want a group, a private channel, or just a plain chat (the bot will send the notification directly to your telegram account, not via group/channel).</p>



<p class="wp-block-paragraph">If you create (or existing) a group or channel, you must invite the bot to the group/channel and assign writing permission to it. So, the bot will be able to post the notifications.</p>



<p class="wp-block-paragraph">Then, add another bot called @JsonDumpBot that allows you to retrieve metadata of a message, including the chat ID, by simply forwarding the message to this bot.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="371" height="313" src="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-57.jpg" alt="" class="wp-image-1989" srcset="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-57.jpg 371w, https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_21-57-300x253.jpg 300w" sizes="(max-width: 371px) 100vw, 371px" /><figcaption class="wp-element-caption">Telegram JsonDumpBot</figcaption></figure>
</div>


<p class="wp-block-paragraph">First, post a dummy text in the group/channel or your own bot, then forward the message to the JsonDumpBot. You&#8217;ll be replied with the metadata in JSON format.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="339" height="625" src="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_22-04.jpg" alt="" class="wp-image-1991" srcset="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_22-04.jpg 339w, https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_22-04-163x300.jpg 163w" sizes="(max-width: 339px) 100vw, 339px" /><figcaption class="wp-element-caption">Getting the Chat ID</figcaption></figure>
</div>


<p class="wp-block-paragraph">Find the part where it says &#8220;chat&#8221; and &#8220;id&#8221;. Then, you get the chat ID.</p>



<h4 class="wp-block-heading has-vivid-cyan-blue-color has-text-color">Notification setup</h4>



<p class="wp-block-paragraph">Back to Uptime Kuma, create a new notification setup and choose Telegram as the type. Fill in the required information.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="498" height="621" src="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_22-10.jpg" alt="" class="wp-image-1993" style="width:374px;height:466px" srcset="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_22-10.jpg 498w, https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_22-10-241x300.jpg 241w" sizes="(max-width: 498px) 100vw, 498px" /><figcaption class="wp-element-caption">Telegram notification settings</figcaption></figure>
</div>


<p class="wp-block-paragraph">Test the notification as always. If you set it up correctly, it will send you the test notification.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="265" height="51" src="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_22-12.jpg" alt="" class="wp-image-1994" style="width:265px;height:51px"/><figcaption class="wp-element-caption">Test notification sent</figcaption></figure>
</div>


<p class="wp-block-paragraph">Done! The telegram notification is now ready! Yay! Now, do the real test just like the email one.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="493" height="108" src="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_22-15.jpg" alt="" class="wp-image-1997" srcset="https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_22-15.jpg 493w, https://serverstadium.com/wp-content/uploads/2022/04/2022-04-04_22-15-300x66.jpg 300w" sizes="(max-width: 493px) 100vw, 493px" /><figcaption class="wp-element-caption">Down-Up alert sent</figcaption></figure>
</div>


<p class="wp-block-paragraph">It&#8217;s awesome! Isn&#8217;t it?</p>



<h2 class="wp-block-heading">Conclusion</h2>



<p class="wp-block-paragraph">To sum up, deploying Uptime Kuma is quick and easy. Also, adding monitors and configuring notifications are simple, thanks to its user-friendly interface.</p>



<p class="wp-block-paragraph">Find more tech insight and tutorial articles in our <strong><a href="https://serverstadium.com/knowledge-base/" target="_blank" rel="noreferrer noopener">Knowledge Base</a></strong>. Have you not tried ServerStadium&#8217;s panel yet? <strong><a href="https://cp.serverstadium.com/regist-user" target="_blank" rel="noreferrer noopener">sign up</a></strong> here, and experience ServerStadium&#8217;s simplicity.</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/monitor-your-services-uptime-using-uptime-kuma/">Monitor Your Services Uptime Using Uptime Kuma</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Install Node.js and Launch Your First Node App</title>
		<link>https://serverstadium.com/knowledge-base/how-to-install-node-js-and-launch-your-first-node-app/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Thu, 15 Apr 2021 03:42:50 +0000</pubDate>
				<guid isPermaLink="false">https://cloudraya.com/knowledge-base/?p=718</guid>

					<description><![CDATA[<p>The popularity of Node.js has increased recently, which makes &#8216;how to install node.js&#8217; a hot topic around the internet. But let&#8217;s discuss what Node.js is. Node.js is a server-side Javascript that makes dev can write the front-end and back-end of web applications in Javascript more easily and efficiently. Node.js is an open-source application under MIT&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/how-to-install-node-js-and-launch-your-first-node-app/">How to Install Node.js and Launch Your First Node App</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">The popularity of Node.js has increased recently, which makes &#8216;how to install node.js&#8217; a hot topic around the internet. But let&#8217;s discuss what Node.js is.<br /><br />Node.js is a server-side Javascript that makes dev can write the front-end and back-end of web applications in Javascript more easily and efficiently. Node.js is an open-source application under MIT License.<br /><br />This tutorial will teach us how to install node.js using the Ubuntu repository, PPA, or NVM. <br />And we will learn how to launch your simple app using node.js.</p>



<ol class="wp-block-list" type="1">
<li>Using Ubuntu repository. We will install using stable nodejs with command apt</li>
<li>Install nodejs using PPA (Personal Package Archive) repository.</li>
<li>Use and install multiple nodejs using NVM (NodeJS Version Manager).</li>
</ol>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Install Node.js using Ubuntu Repository</h2>



<p class="wp-block-paragraph">Please ssh your server on Cloudraya and make sure you have created a security profile to allow accessing your server.</p>



<p class="wp-block-paragraph">After you login into your server, run the command below:</p>



<pre class="wp-block-preformatted"># apt update</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="663" height="186" class="wp-image-743" src="https://serverstadium.com/wp-content/uploads/2021/01/image-6.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/image-6.png 663w, https://serverstadium.com/wp-content/uploads/2021/01/image-6-300x84.png 300w" sizes="(max-width: 663px) 100vw, 663px" /></figure>



<pre class="wp-block-preformatted"># apt install nodejs</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="556" height="239" class="wp-image-745" src="https://serverstadium.com/wp-content/uploads/2021/01/image-8.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/image-8.png 556w, https://serverstadium.com/wp-content/uploads/2021/01/image-8-300x129.png 300w" sizes="(max-width: 556px) 100vw, 556px" /></figure>



<p class="wp-block-paragraph">Run the command below to find nodejs version:</p>



<pre class="wp-block-preformatted"># nodejs -v</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="269" height="35" class="wp-image-746" src="https://serverstadium.com/wp-content/uploads/2021/01/image-9.png" alt="" /></figure>



<p class="wp-block-paragraph">If you want to find some module or package of nodejs, we can use NPM (NodeJS Package Manager). You can install it using the command :</p>



<pre class="wp-block-preformatted">#apt install npm</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="615" height="47" class="wp-image-748" src="https://serverstadium.com/wp-content/uploads/2021/01/image-11.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/image-11.png 615w, https://serverstadium.com/wp-content/uploads/2021/01/image-11-300x23.png 300w" sizes="(max-width: 615px) 100vw, 615px" /></figure>



<pre class="wp-block-preformatted"># npm -v</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="257" height="30" class="wp-image-750" src="https://serverstadium.com/wp-content/uploads/2021/01/image-13.png" alt="" /></figure>



<p class="wp-block-paragraph">Now your server is ready to use nodejs.</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Install Node.js Using PPA (Personal Package Archive) Repository</h2>



<p class="wp-block-paragraph">If we want to use nodejs with the latest version, we can use nodejs using PPA Repository that is maintained by NodeSource.</p>



<p class="wp-block-paragraph">We can find version nodejs on <a href="https://github.com/nodesource/distributions">https://github.com/nodesource/distributions</a>.<br />Run the command below to install nodejs v.12.</p>



<pre class="wp-block-preformatted"># curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="659" height="104" class="wp-image-751" src="https://serverstadium.com/wp-content/uploads/2021/01/image-14.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/image-14.png 659w, https://serverstadium.com/wp-content/uploads/2021/01/image-14-300x47.png 300w" sizes="(max-width: 659px) 100vw, 659px" /></figure>



<p class="wp-block-paragraph">If we use nodejs from PPA, npm is automatically installed on your server.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="284" height="62" class="wp-image-753" src="https://serverstadium.com/wp-content/uploads/2021/01/image-16.png" alt="" /></figure>



<p class="wp-block-paragraph">&nbsp;</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Install Node.js Using NVM (NodeJS Version Manager)</h2>



<p class="wp-block-paragraph">Nodejs allow us to install multiple nodejs versions on the server.<br />We recommend you use nodejs with NodeJs Version Manager (NVM). After we install nodejs using NVM, we can change the default nodejs version if we install multiple nodejs on the server.</p>



<p class="wp-block-paragraph">Below is how to install nodejs using NVM:</p>



<pre class="wp-block-preformatted"># apt install build-essential libssl-dev</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="528" height="212" class="wp-image-754" src="https://serverstadium.com/wp-content/uploads/2021/01/image-17.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/image-17.png 528w, https://serverstadium.com/wp-content/uploads/2021/01/image-17-300x120.png 300w" sizes="(max-width: 528px) 100vw, 528px" /></figure>



<pre class="wp-block-preformatted"># curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="740" height="299" class="wp-image-755" src="https://serverstadium.com/wp-content/uploads/2021/01/image-18.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/image-18.png 740w, https://serverstadium.com/wp-content/uploads/2021/01/image-18-300x121.png 300w" sizes="(max-width: 740px) 100vw, 740px" /></figure>



<p class="wp-block-paragraph">After the installation is completed, please allow NVM to run on bash profile user .</p>



<pre class="wp-block-preformatted"># source ~/.profile</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="344" height="40" class="wp-image-756" src="https://serverstadium.com/wp-content/uploads/2021/01/image-19.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/image-19.png 344w, https://serverstadium.com/wp-content/uploads/2021/01/image-19-300x35.png 300w" sizes="(max-width: 344px) 100vw, 344px" /></figure>



<p class="wp-block-paragraph">List the nodejs version using the command below:</p>



<pre class="wp-block-preformatted"># nvm ls-remote</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="421" height="331" class="wp-image-765" src="https://serverstadium.com/wp-content/uploads/2021/01/image-26.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/image-26.png 421w, https://serverstadium.com/wp-content/uploads/2021/01/image-26-300x236.png 300w" sizes="(max-width: 421px) 100vw, 421px" /></figure>



<p class="wp-block-paragraph">In this article, we will use nodejs LTS version with version 14.</p>



<pre class="wp-block-preformatted"># nvm install 14.15.3</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="616" height="125" class="wp-image-758" src="https://serverstadium.com/wp-content/uploads/2021/01/image-21.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/image-21.png 616w, https://serverstadium.com/wp-content/uploads/2021/01/image-21-300x61.png 300w" sizes="(max-width: 616px) 100vw, 616px" /></figure>



<p class="wp-block-paragraph">As we know, using NVM we can run multiple nodejs version on the server.<br />Now we will install nodejs version 8.</p>



<pre class="wp-block-preformatted"># nvm install 8.17.0</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="619" height="111" class="wp-image-759" src="https://serverstadium.com/wp-content/uploads/2021/01/image-22.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/image-22.png 619w, https://serverstadium.com/wp-content/uploads/2021/01/image-22-300x54.png 300w" sizes="(max-width: 619px) 100vw, 619px" /></figure>



<p class="wp-block-paragraph">Please run the command below to find nodejs version that is installed on the server.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="297" height="228" class="wp-image-762" src="https://serverstadium.com/wp-content/uploads/2021/01/image-24.png" alt="" /></figure>



<p class="wp-block-paragraph">We can see if the default nodejs on the server is nodejs version 14.<br />If we want to change the nodejs version 8, we can use the command below:</p>



<pre class="wp-block-preformatted"># nvm use 8</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="295" height="63" class="wp-image-763" src="https://serverstadium.com/wp-content/uploads/2021/01/image-25.png" alt="" /></figure>



<p class="wp-block-paragraph">&nbsp;</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading"><strong>Launch </strong>Y<strong>our First Node App</strong></h2>



<p class="wp-block-paragraph">After we know how to install nodejs on the server using many different ways. Now we can learn how to launch your first node App on the server.</p>



<p class="wp-block-paragraph">Create folder nodejsapp and create a file as app.js</p>



<pre class="wp-block-preformatted">#mkdir nodejsapp
#cd nodejsapp
#nano app.js</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="363" height="46" class="wp-image-766" src="https://serverstadium.com/wp-content/uploads/2021/01/image-27.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/image-27.png 363w, https://serverstadium.com/wp-content/uploads/2021/01/image-27-300x38.png 300w" sizes="(max-width: 363px) 100vw, 363px" /></figure>



<p class="wp-block-paragraph">Append the code below on file app.js</p>



<pre class="wp-block-preformatted">console.log('This NodeJS Application in Cloudraya');</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="404" height="109" class="wp-image-767" src="https://serverstadium.com/wp-content/uploads/2021/01/image-28.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/image-28.png 404w, https://serverstadium.com/wp-content/uploads/2021/01/image-28-300x81.png 300w" sizes="(max-width: 404px) 100vw, 404px" /></figure>



<p class="wp-block-paragraph">Press Ctrl + x to save and quit from the editor.</p>



<p class="wp-block-paragraph">Run the command below to execute the code of app.js</p>



<pre class="wp-block-preformatted">#chmod +x app.js
#nodejs app.js or node app.js (if you use NVM)</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="394" height="48" class="wp-image-768" src="https://serverstadium.com/wp-content/uploads/2021/01/image-29.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/image-29.png 394w, https://serverstadium.com/wp-content/uploads/2021/01/image-29-300x37.png 300w" sizes="(max-width: 394px) 100vw, 394px" /></figure>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading"><strong>Create Local Webserver</strong></h2>



<p class="wp-block-paragraph">Nodejs is a client-side server language which means we can run it without any webserver like nginx or apache. With nodejs we can create a local webserver on the server.<br /><br />First, we create a file server.js and append the code below on the file</p>



<pre class="wp-block-preformatted"># nano server.js</pre>



<pre class="wp-block-preformatted">var http = require('http');<br />var server = http.createServer(function (req, res) {<br />        res.writeHead(200,{'Content-Type': 'text/plain'});<br />        res.end('NodeJS App');<br />});<br />server.listen(5050);<br />console.log('Server is running at <a href="http://localhost:5050/">http://localhost:5050/</a>');</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="440" height="180" class="wp-image-769" src="https://serverstadium.com/wp-content/uploads/2021/01/image-30.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/image-30.png 440w, https://serverstadium.com/wp-content/uploads/2021/01/image-30-300x123.png 300w" sizes="(max-width: 440px) 100vw, 440px" /></figure>



<p class="wp-block-paragraph">Exit from the edit by press Ctrl + x to save and quit.</p>



<p class="wp-block-paragraph">The code we have appended on the file means making a server connection on port 5050. Please run the command below to run the local webserver</p>



<pre class="wp-block-preformatted"># nodejs server.js / node server.js (NVM)</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="382" height="76" class="wp-image-771" src="https://serverstadium.com/wp-content/uploads/2021/01/image-32.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/image-32.png 382w, https://serverstadium.com/wp-content/uploads/2021/01/image-32-300x60.png 300w" sizes="(max-width: 382px) 100vw, 382px" /></figure>



<p class="wp-block-paragraph">Now we can reach the node app via http://ip_address_server:5050 from any browser.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="502" height="283" class="wp-image-772" src="https://serverstadium.com/wp-content/uploads/2021/01/image-33.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/image-33.png 502w, https://serverstadium.com/wp-content/uploads/2021/01/image-33-300x169.png 300w" sizes="(max-width: 502px) 100vw, 502px" /></figure>



<p class="wp-block-paragraph">If you see the message above, you successfully launched the node app on the ServerStadium VM server.<br />Please submit your question to our Support if you need more assistance.</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/how-to-install-node-js-and-launch-your-first-node-app/">How to Install Node.js and Launch Your First Node App</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
