<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="https://nirajankunwor.com.np/feed.xml" rel="self" type="application/atom+xml"/><link href="https://nirajankunwor.com.np/" rel="alternate" type="text/html" hreflang="en"/><updated>2026-10-02T05:33:31+00:00</updated><id>https://nirajankunwor.com.np/feed.xml</id><title type="html">blank</title><subtitle>Nirajan Kunwor — Senior Software Engineer. Research interests in machine learning, medical AI, computer vision, domain generalization, test-time adaptation, federated learning. </subtitle><entry><title type="html">Secure File Transfer: A Beginner’s Guide to Uploading and Downloading Files with SCP</title><link href="https://nirajankunwor.com.np/blog/2024/secure-file-transfer-a-beginners-guide-to-uploading-and-downloading-files-with-scp/" rel="alternate" type="text/html" title="Secure File Transfer: A Beginner’s Guide to Uploading and Downloading Files with SCP"/><published>2024-11-22T04:11:33+00:00</published><updated>2024-11-22T04:11:33+00:00</updated><id>https://nirajankunwor.com.np/blog/2024/secure-file-transfer-a-beginners-guide-to-uploading-and-downloading-files-with-scp</id><content type="html" xml:base="https://nirajankunwor.com.np/blog/2024/secure-file-transfer-a-beginners-guide-to-uploading-and-downloading-files-with-scp/"><![CDATA[<p>Transferring files securely between a local machine and a remote server is a common task for developers, system administrators, and anyone managing servers. One of the most secure and efficient ways to achieve this is by using <strong>SCP (Secure Copy Protocol)</strong>. In this blog, I’ll walk you through the process of uploading and downloading files with SCP, using an example command for each case.</p> <h3>What is SCP?</h3> <p>SCP is a command-line tool that allows you to transfer files between your local machine and a remote server over an encrypted SSH connection. This ensures your files remain secure during the transfer process. It’s simple, fast, and widely used in the tech world.</p> <figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OCWQ9ablu_l52Zeotz-7XA.png"/></figure> <h3>1. Uploading Files to the Server</h3> <p>Let’s say you want to upload a file named backend.zip from your local machine to a remote server’s /home/ubuntu/ directory.</p> <p>Here’s the command:</p> <pre>scp -i abc.pem backend.zip ubuntu@10.10.10.10:/home/ubuntu/</pre> <p><strong>Explanation:</strong></p> <ul><li>scp: Invokes the SCP command.</li><li>-i abc.pem: Specifies the private key file for authentication.</li><li>backend.zip: The file on your local machine that you want to upload.</li><li>ubuntu@10.10.10.10: The username (ubuntu) and the server’s IP address (10.10.10.10).</li><li>/home/ubuntu/: The destination directory on the server.</li></ul> <h3>2. Downloading Files from the Server</h3> <p>To download the backend.zip file from the remote server’s /home/ubuntu/ directory to your local machine’s ~/Downloads folder, use the following command:</p> <pre>scp -i abc.pem ubuntu@10.10.10.10:/home/ubuntu/backend.zip ~/Downloads/</pre> <p><strong>Explanation:</strong></p> <ul><li>scp: Invokes the SCP command.</li><li>-i abc.pem: Specifies the private key file for authentication.</li><li>ubuntu@10.10.10.10:/home/ubuntu/backend.zip: The file’s path on the remote server.</li><li>~/Downloads/: The destination folder on your local machine.</li></ul> <h3>Key Points to Remember</h3> <ol><li><strong>Use Absolute Paths for Clarity</strong>: Always use full paths for both local and remote locations to avoid confusion.</li><li><strong>File Permissions</strong>: Ensure you have the correct permissions for the directory where the file is being uploaded or downloaded.</li><li><strong>Security Matters</strong>: Keep your private key (abc.pem) secure and do not share it with anyone.</li></ol> <h3>Conclusion</h3> <p>Using SCP for secure file transfer is an essential skill for anyone working with remote servers. Whether you’re deploying a project or backing up important files, SCP provides a secure and straightforward way to move your data.</p> <h3>In Plain English 🚀</h3> <p><em>Thank you for being a part of the </em><a href="https://plainenglish.io/"><strong><em>In Plain English</em></strong></a><em> community! Before you go:</em></p> <ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://x.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong>YouTube</strong></a> | <a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a> | <a href="https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0"><strong>Podcast</strong></a></li><li><a href="https://differ.blog/"><strong>Create a free AI-powered blog on Differ.</strong></a></li><li>More content at <a href="https://plainenglish.io/"><strong>PlainEnglish.io</strong></a></li></ul> <p><img src="https://medium.com/_/stat?event=post.clientViewed&amp;referrerSource=full_rss&amp;postId=a2b9f0f4837f" width="1" height="1" alt=""/>&lt;hr&gt;&lt;p&gt;<a href="https://javascript.plainenglish.io/secure-file-transfer-a-beginners-guide-to-uploading-and-downloading-files-with-scp-a2b9f0f4837f">Secure File Transfer: A Beginner’s Guide to Uploading and Downloading Files with SCP</a> was originally published in <a href="https://javascript.plainenglish.io">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.&lt;/p&gt;</p>]]></content><author><name></name></author><category term="remote-server"/><category term="scp"/><category term="life"/><category term="security"/><category term="servers"/><category term="medium"/></entry><entry><title type="html">5 Essential Node.js Security Best Practices to Keep Your Application Safe</title><link href="https://nirajankunwor.com.np/blog/2024/5-essential-nodejs-security-best-practices-to-keep-your-application-safe/" rel="alternate" type="text/html" title="5 Essential Node.js Security Best Practices to Keep Your Application Safe"/><published>2024-11-06T05:25:35+00:00</published><updated>2024-11-06T05:25:35+00:00</updated><id>https://nirajankunwor.com.np/blog/2024/5-essential-nodejs-security-best-practices-to-keep-your-application-safe</id><content type="html" xml:base="https://nirajankunwor.com.np/blog/2024/5-essential-nodejs-security-best-practices-to-keep-your-application-safe/"><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ObdMJEotfHAcgFCo"/></figure> <ol><li><strong>Rate Limiting: </strong>Rate limiting and throttling are essential techniques to protect applications from abuse, such as brute-force attacks, denial-of-service (DoS) attacks, and resource exhaustion. They help ensure that your application can handle genuine traffic without being overwhelmed by excessive requests from single or multiple sources.</li></ol> <p><strong>Using </strong><strong><em>express-rate-limit</em> in Node.js:<br/></strong>express-rate-limit is a middleware package for Express applications that provides a straightforward way to set rate limits on your API endpoints.</p> <pre>// Define rate limit<br />const limiter = rateLimit({<br />  windowMs: 15 * 60 * 1000, // 15 minutes<br />  max: 100, // limit each IP to 100 requests per windowMs<br />  message: &quot;Too many requests from this IP, please try again later.&quot;,<br />});<br /><br />// Apply the rate limit to all requests<br />app.use(limiter);</pre> <p>It’s not ideal for handling high volumes of traffic, as the rate limiting logic is processed by the Node.js server itself, which can still be vulnerable to high traffic.</p> <p><strong>Using Rate Limiting at the Nginx Server Level:<br/></strong>Nginx is designed to handle a high number of requests efficiently, and performing rate limiting directly at the web server level reduces the load on the application server (Node.js). This keeps your backend resources focused on serving legitimate requests.</p> <pre>http {<br />  # Define a limit request zone<br />  limit_req_zone $binary_remote_addr zone=api_limit:10m rate=10r/s;<br /><br />  server {<br />    listen 80;<br /><br />    location /api/ {<br />      # Apply rate limiting<br />      limit_req zone=api_limit burst=20 nodelay;<br />      proxy_pass http://your-node-app;<br />    }<br />  }<br />}</pre> <ul><li>limit_req_zone $binary_remote_addr zone=api_limit:10m rate=10r/s;: This directive defines a zone named api_limit that allows up to 10 requests per second per IP address. $binary_remote_addr tracks IP addresses in a compact, binary format.</li><li>burst=20: Allows up to 20 requests to exceed the rate limit in short bursts.</li><li>nodelay: Sends the requests immediately if there’s available burst capacity.</li></ul> <p><strong>2. JWT Blacklisting:</strong></p> <p>JWTs cannot be invalidated by default because they are stateless. This means:</p> <blockquote>If a token is compromised or if a user logs out, there’s no built-in way to invalidate the token.</blockquote> <blockquote>Until the token expires, the holder of the token can access the application’s resources.</blockquote> <p>To overcome this, we use <strong>JWT blacklisting</strong>. Blacklisting is especially important for refresh tokens, as they are long-lived and allow users to get new access tokens.</p> <h4>Using a Rotating Refresh Token Strategy</h4> <ul><li><strong>Generate and Rotate Refresh Tokens</strong>:</li></ul> <blockquote>When a user requests a new access token, generate a new refresh token and save it in the database or Redis with a reference to the user. Invalidate the old refresh token by removing it from the database.</blockquote> <pre>async function refreshTokens(oldRefreshToken) {<br />  const decoded = verifyRefreshToken(oldRefreshToken);<br /><br />  // Check if the token is still valid in the database<br />  const storedToken = await db.getRefreshToken(decoded.jti);<br />  if (!storedToken) return res.status(401).send(&quot;Invalid refresh token&quot;);<br /><br />  // Generate a new refresh token and invalidate the old one<br />  const newRefreshToken = generateRefreshToken(decoded.userId);<br />  await db.saveRefreshToken(newRefreshToken);<br />  await db.deleteRefreshToken(decoded.jti);<br /><br />  return newRefreshToken;<br />}</pre> <ul><li><strong>Store Only the Latest Refresh Token</strong>:</li></ul> <blockquote>Only one valid refresh token exists at any given time for a user. If a user tries to use an old refresh token, it will no longer be in the database or cache, so it will be rejected.</blockquote> <p><strong>3. Preventing XSS in Node.js Applications</strong></p> <p><strong>Sanitize and Validate User Inputs</strong></p> <ul><li>XSS vulnerabilities often arise when user-provided data is rendered on the page without proper sanitization. For instance, if users can submit comments or messages, an attacker might inject malicious JavaScript code that would execute on another user’s browser.</li><li>Use input validation libraries like express-validator or Joi to ensure inputs meet specific formats and strip out potentially dangerous characters.</li></ul> <pre>const { body, validationResult } = require(&#39;express-validator&#39;);<br /><br />app.post(&#39;/submit-comment&#39;, [<br />  body(&#39;comment&#39;).isString().trim().escape(), // Sanitize input<br />], (req, res) =&gt; {<br />  const errors = validationResult(req);<br />  if (!errors.isEmpty()) {<br />    return res.status(400).json({ errors: errors.array() });<br />  }<br />  // Process comment here<br />});</pre> <p><strong>Escape Output Properly</strong></p> <ul><li>If you’re rendering HTML on the server-side (e.g., using template engines like EJS, Pug, or Handlebars), ensure all data that comes from user input is properly escaped. Most modern templating engines handle this by default, but it’s good practice to double-check.</li><li>Escaping converts special characters (&lt;, &gt;, &amp;, &quot;, &#39;) to HTML entities so they’re displayed as text rather than interpreted as HTML or JavaScript.</li></ul> <p><strong>Use Content Security Policy (CSP) Headers</strong></p> <pre>const helmet = require(&#39;helmet&#39;);<br /><br />app.use(helmet.contentSecurityPolicy({<br />  directives: {<br />    defaultSrc: [&quot;&#39;self&#39;&quot;],<br />    scriptSrc: [&quot;&#39;self&#39;&quot;, &#39;https://trusted-scripts.com&#39;], // Allow only trusted sources<br />    objectSrc: [&quot;&#39;none&#39;&quot;], // Prevent plugins like Flash<br />    upgradeInsecureRequests: [],<br />  },<br />}));</pre> <p><strong>X-XSS-Protection Header</strong></p> <pre>app.use(helmet.xssFilter());</pre> <p><strong>4. Implement Secure Session Management</strong></p> <blockquote>Set Secure Cookies</blockquote> <p>Cookies are often used to store session IDs, so it’s important to configure them securely:</p> <ul><li><strong>Secure Flag</strong>: Set the Secure flag on cookies so they are only sent over HTTPS connections.</li><li><strong>HttpOnly Flag</strong>: Set the HttpOnly flag to prevent JavaScript access to cookies, which helps protect against XSS attacks.</li><li><strong>SameSite Attribute</strong>: Set SameSite to Strict or Lax to restrict cross-site request behavior, reducing the risk of CSRF (Cross-Site Request Forgery) attacks.</li></ul> <pre>const session = require(&#39;express-session&#39;);<br />// Generating a secret using Node&#39;s crypto module<br />const crypto = require(&#39;crypto&#39;);<br />const sessionSecret = crypto.randomBytes(64).toString(&#39;hex&#39;);<br /><br />app.use(session({<br />  secret: sessionSecret,<br />  resave: false,<br />  saveUninitialized: true,<br />  cookie: {<br />    httpOnly: true,      // Prevents JavaScript access to cookies<br />    secure: true,        // Ensures cookies are only sent over HTTPS (useful in production)<br />    sameSite: &#39;lax&#39;      // Mitigates CSRF attacks by restricting cross-site requests<br />  }<br />}));</pre> <blockquote>Use Short Session Expiration and Automatic Session Renewal</blockquote> <p>Sessions that last too long increase the risk of session hijacking if an attacker gains access to a session token. Implementing session expiration and automatic renewal minimizes this risk.</p> <ul><li><strong>Short Expiry Times</strong>: Set short expiration times for session cookies, depending on your application’s needs. For example, a session timeout of 15–30 minutes of inactivity is common.</li><li><strong>Automatic Renewal</strong>: Renew session expiration on each interaction to keep active users logged in but expire inactive sessions automatically.</li></ul> <pre>app.use(session({<br />  secret: &#39;your-secret-key&#39;,<br />  resave: false,<br />  saveUninitialized: true,<br />  cookie: {<br />    maxAge: 30 * 60 * 1000,  // 30 minutes<br />  }<br />}));<br /><br />// Middleware to renew session expiration on each request<br />app.use((req, res, next) =&gt; {<br />  if (req.session) {<br />    req.session._garbage = Date();<br />    req.session.touch();<br />  }<br />  next();<br />});</pre> <p><strong>5. Prevent HTTP parameter pollution</strong></p> <p>To prevent HTTP Parameter Pollution, you can use the hpp middleware in your Node.js application. The hpp library (short for <strong>HTTP Parameter Pollution</strong>) is a simple, effective tool for handling duplicate parameters. It ensures that only the first occurrence of a parameter is accepted, discarding duplicates and eliminating potential issues.</p> <pre>const express = require(&#39;express&#39;);<br />const hpp = require(&#39;hpp&#39;);<br /><br />const app = express();<br /><br />// Apply hpp middleware<br />app.use(hpp());<br /><br />app.get(&#39;/search&#39;, (req, res) =&gt; {<br />  // Only the first instance of each query parameter is used<br />  console.log(req.query); // { category: &#39;electronics&#39; }<br />  res.send(&#39;Search results&#39;);<br />});<br /><br />app.listen(3000, () =&gt; {<br />  console.log(&#39;Server running on port 3000&#39;);<br />});</pre> <p>In this example, if a request like https://example.com/search?category=electronics&amp;category=clothing is made, the hpp middleware will ensure only the first category parameter is considered (electronics), and the duplicate is ignored.</p> <p>Securing a Node.js application requires a proactive approach across various layers of your stack. By implementing best practices like rate limiting, JWT blacklisting, secure session management, and protections against XSS and HTTP parameter pollution, you can greatly reduce the risk of common vulnerabilities. Prioritizing security not only protects your data but strengthens the overall resilience of your application.</p> <h3>In Plain English 🚀</h3> <p><em>Thank you for being a part of the </em><a href="https://plainenglish.io/"><strong><em>In Plain English</em></strong></a><em> community! Before you go:</em></p> <ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://x.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong>YouTube</strong></a> | <a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a> | <a href="https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0"><strong>Podcast</strong></a></li><li><a href="https://differ.blog/"><strong>Create a free AI-powered blog on Differ.</strong></a></li><li>More content at <a href="https://plainenglish.io/"><strong>PlainEnglish.io</strong></a></li></ul> <p><img src="https://medium.com/_/stat?event=post.clientViewed&amp;referrerSource=full_rss&amp;postId=3c3839022192" width="1" height="1" alt=""/>&lt;hr&gt;&lt;p&gt;<a href="https://javascript.plainenglish.io/5-essential-node-js-security-best-practices-to-keep-your-application-safe-3c3839022192">5 Essential Node.js Security Best Practices to Keep Your Application Safe</a> was originally published in <a href="https://javascript.plainenglish.io">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.&lt;/p&gt;</p>]]></content><author><name></name></author><category term="expressjs"/><category term="security"/><category term="nodejs"/><category term="medium"/></entry><entry><title type="html">Migrating Your Existing Node.js App to AWS Lightsail: A Practical Guide</title><link href="https://nirajankunwor.com.np/blog/2024/migrating-your-existing-nodejs-app-to-aws-lightsail-a-practical-guide/" rel="alternate" type="text/html" title="Migrating Your Existing Node.js App to AWS Lightsail: A Practical Guide"/><published>2024-07-15T15:42:57+00:00</published><updated>2024-07-15T15:42:57+00:00</updated><id>https://nirajankunwor.com.np/blog/2024/migrating-your-existing-nodejs-app-to-aws-lightsail-a-practical-guide</id><content type="html" xml:base="https://nirajankunwor.com.np/blog/2024/migrating-your-existing-nodejs-app-to-aws-lightsail-a-practical-guide/"><![CDATA[<h3><strong>INTRODUCTION</strong></h3> <p>Amazon Lightsail offers a simplified way to deploy and manage applications in the cloud. In this guide, we’ll walk through the process of hosting a Node.js application on an AWS Lightsail instance, taking advantage of its user-friendly interface and seamless integration with AWS services.</p> <h3>PREREQUISITES</h3> <ul><li>Basic knowledge of Node.js and npm</li><li>An AWS Account</li><li>Familiarity with Linux command line</li><li>Your existing Node.js application code</li></ul> <h3><strong>Preparing for Migration</strong></h3> <h4>a. Choose a Lightsail plan:</h4> <p>Login to the AWS console and search or Navigate to the Light Sail console below shown image and click on the create instance for creating a server.</p> <figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IZoy2OTB6HAeEwv9kLO3UA.png"/></figure> <p>Next you have to choose the Image you want for your server since most of the nodejs applications runs based on the Ubuntu server. I choose choose the OS only option and manually configure all needs, then scroll down for next.</p> <figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4GeBUdZHhwnNCOn2zF6SoQ.png"/></figure> <p>Select a pricing model that suits your applications need.</p> <figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LIg_H_wAgwsJ3n0vvRedfA.png"/></figure> <p>Add your instance name and click create instance as shown on the picture below.</p> <figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jl6iXl29ZV62MMjJkNt3ng.png"/></figure> <p>Once created, you can see the instance spinning up and ready in a while.</p> <figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PUGVRtR75KqcI6phV0Xabg.png"/></figure> <h4>b. Configuring Lightsail:</h4> <p>Click on the instance and you will then move into the detailed view of the instance. Click on the networking tab.</p> <figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8I8OMr6GLhs6NILt2uBM0Q.png"/></figure> <figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p8lNNHAiY2SesKC8aSBCGg.png"/></figure> <p>On networking, add the port as custom which is used in your nodejs application like 3000 or 5000 as seen in the image below.<br/>Used for Secure Shell (SSH) connections</p> <ul><li><strong>Port 22 (SSH):</strong> Used for Secure Shell (SSH) connections</li><li><strong>Port 80 (HTTP):</strong> Used for standard web traffic</li><li><strong>Port 443 (HTTPS):</strong> Used for secure web traffic</li><li><strong>Port 5000 (Custom):</strong> This is a custom nodejs application port</li><li><strong>Port 5000 (Custom):</strong> Another custom application port</li></ul> <h4>C. Deploying your Node.js Application</h4> <figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*CAXetlu0fIZpmpjXQ57Q7A.png"/></figure> <ul><li>Open ssh and move to root. Run following commands.</li></ul> <blockquote>sudo apt-get update<br/>curl -o- <a href="https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh">https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh</a> | bash<br/><em>nvm --version<br/></em>nvm install node<br/>nvm install 18<br/><em>nvm use 18</em></blockquote> <ul><li>Clone the project in any location on home or create a new folder. Install pm2 process manager and start the project.</li></ul> <pre>git clone &lt;paste project git url&gt;<br />npm install<br />sudo npm install pm2 -g<br />pm2 start index.js --name booking-application-backend<br />pm2 startup systemd<br />pm2 save<br /></pre> <ul><li>Clone the project in any location on home or create a new folder. Install pm2 process manager and start the project.</li></ul> <h4>D. Reverse proxy setup:</h4> <p>If your Node.js application operates on a non-standard port (such as 3000 or 5000), consider setting up a reverse proxy using Nginx or another server. This will forward requests to your Node.js application, bolstering security and enabling the use of a custom domain.</p> <pre>sudo apt install nginx<br /><br />sudo systemctl start nginx<br /><br />sudo systemctl enable nginx<br /><br /></pre> <ul><li>Place your project files in /var/www/html/</li><li>Edit the default configuration file at /etc/nginx/sites-available/default</li><li>Open the default file using: vi default</li></ul> <pre>server_name yourdomain.com www.yourdomain.com;<br /><br />    location / {<br />        proxy_pass http://localhost:8000; # your app&#39;s port<br />        proxy_http_version 1.1;<br />        proxy_set_header Upgrade $http_upgrade;<br />        proxy_set_header Connection &#39;upgrade&#39;;<br />        proxy_set_header Host $host;<br />        proxy_cache_bypass $http_upgrade;<br />    }</pre> <pre>sudo systemctl reload nginx</pre> <p>If you are using a custom domain name, go to your dns provider and add A record</p> <figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*ExVVVMDytG4KM5sDs7j9qw.png"/></figure> <h4>E. Setup SSL/TLS</h4> <p>Finally, the only task left to do here is to secure our web server with SSL encryption. We can do this with the Certbot library very easily.</p> <p>Install Certbot and prepare certbot command.</p> <pre>sudo snap install --classic certbot</pre> <pre>sudo ln -s /snap/bin/certbot /usr/bin/certbot</pre> <p>Run this command to get a certificate and have Certbot edit your nginx configuration automatically to serve it, turning on HTTPS access in a single step.</p> <pre>sudo certbot - nginx</pre> <p>Test automatic renewal</p> <pre>sudo certbot renew --dry-run</pre> <p>To confirm that your site is set up properly, visit https://yourwebsite.com/ in your browser and look for the lock icon in the URL bar.</p> <p>That’s it. Now you have a secure web application running in your AWS Lightsail Instance. 👏</p> <p><strong>Conclusion:</strong><br/>AWS Lightsail streamlines Node.js application hosting, combining the power of AWS infrastructure with a user-friendly interface. This approach lets developers focus on crafting exceptional applications rather than grappling with complex server management. By following a straightforward deployment process, you can effortlessly launch, maintain, and expand your Node.js projects, freeing up valuable time and resources for innovation and feature development.</p> <h3>In Plain English 🚀</h3> <p><em>Thank you for being a part of the </em><a href="https://plainenglish.io/"><strong><em>In Plain English</em></strong></a><em> community! Before you go:</em></p> <ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://x.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong>YouTube</strong></a> | <a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a> | <a href="https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0"><strong>Podcast</strong></a></li><li><a href="https://differ.blog/"><strong>Create a free AI-powered blog on Differ.</strong></a></li><li>More content at <a href="https://plainenglish.io/"><strong>PlainEnglish.io</strong></a></li></ul> <p><img src="https://medium.com/_/stat?event=post.clientViewed&amp;referrerSource=full_rss&amp;postId=32b4b32683d9" width="1" height="1" alt=""/>&lt;hr&gt;&lt;p&gt;<a href="https://javascript.plainenglish.io/migrating-your-existing-node-js-app-to-aws-lightsail-a-practical-guide-32b4b32683d9">Migrating Your Existing Node.js App to AWS Lightsail: A Practical Guide</a> was originally published in <a href="https://javascript.plainenglish.io">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.&lt;/p&gt;</p>]]></content><author><name></name></author><category term="cloud"/><category term="deployment"/><category term="aws"/><category term="devops"/><category term="nodejs"/><category term="medium"/></entry><entry><title type="html">SOLID principles made easy — JavaScript &amp;amp; TypeScript</title><link href="https://nirajankunwor.com.np/blog/2022/solid-principles-made-easy-javascript-typescript/" rel="alternate" type="text/html" title="SOLID principles made easy — JavaScript &amp;amp; TypeScript"/><published>2022-11-25T11:32:10+00:00</published><updated>2022-11-25T11:32:10+00:00</updated><id>https://nirajankunwor.com.np/blog/2022/solid-principles-made-easy--javascript--typescript</id><content type="html" xml:base="https://nirajankunwor.com.np/blog/2022/solid-principles-made-easy-javascript-typescript/"><![CDATA[<p>The <strong>SOLID </strong>Principles are five principles of Object-Oriented class design. They are a set of rules and best practices to follow while designing a class structure.</p> <p>So, what is <strong>SOLID</strong>? How does it help us write better code? Simply put, these principles encourage us to create more maintainable, understandable and clean code.</p> <figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nt1IPBOB4NzEIshmkJ8e1Q.jpeg"/></figure> <p>Following the <strong>SOLID</strong> acronym, they are:</p> <p><strong>[S]</strong> Single Responsibility Principle</p> <p>There should never be more than one reason for a class to change. In other words, every class should have only one responsibility.</p> <p><strong>[O]</strong> Open–Closed Principle</p> <p>Software entities like classes, functions, etc should be open for extension, but closed for modification.</p> <p><strong>[L]</strong> Liskov Substitution Principle</p> <p>Subclasses should be substitutable for their base classes.</p> <p><strong>[I]</strong> Interface Segregation Principle</p> <p>This principle states that many client-specific interfaces are better than one general-purpose interface. Clients should not be forced to implement a function they do no need.</p> <p><strong>[D]</strong> Dependency Inversion Principle</p> <p>High level modules should not depend on low level modules; both should depend on abstractions.</p> <p>Let’s learn about these principles in detail with some examples in Javascript and Typescript.</p> <h3># Single Responsibility Principle</h3> <blockquote>The single responsibility principle states that every module, class or function in a computer program should have responsibility over a single part of program’s functionality.</blockquote> <p>If a class has many responsibilities, it increases the possibility of bugs as making change to any of the functionality may affect others without knowing.</p> <p><strong>Advantages</strong></p> <ul><li>Clean and standard code</li><li>Manageable and easy for maintenance</li><li>Easy to refactor or change</li><li>Readable code</li></ul> <p><strong>Disadvantages</strong></p> <ul><li>To many small modules/classes</li><li>Take more time for development and increases project cost</li></ul> <h4>Example</h4> <p>Let’s take a look at the following code:</p> <pre>class TodoList {<br />  constructor() {<br />    this.items = []<br />  }<br /><br />  addItem(item) {<br />    this.items.push(item)<br />  }<br /><br />  removeItem(index) {<br />    this.items = items.splice(index, 1)<br />  }<br /><br />  toString() {<br />    return this.items.toString()<br />  }<br /><br />  save(filename) {<br />    fs.writeFileSync(filename, this.toString())<br />  }<br /><br />  load(filename) {<br />    fs.readFileSync(filename, {encoding:&#39;utf8&#39;, flag:&#39;r&#39;})<br />  }<br />}</pre> <p>This class violates the Single responsibility principle. We added two functions save(filename) and load(filename) in TodoList class.</p> <p>Let’s fix the code so that it complies with the “S” principle.</p> <pre>class TodoList {<br />  constructor() {<br />    this.items = []<br />  }<br /><br />  addItem(item) {<br />    this.items.push(item)<br />  }<br /><br />  removeItem(index) {<br />    this.items = items.splice(index, 1)<br />  }<br /><br />  toString() {<br />    return this.items.toString()<br />  }<br />}<br /><br />class DatabaseManager {<br />  saveToFile(data, filename) {<br />    fs.writeFileSync(filename, data.toString())<br />  }<br /><br />  load(filename) {<br />    fs.readFileSync(filename, {encoding:&#39;utf8&#39;, flag:&#39;r&#39;})<br />  }<br />}</pre> <p>Thus our code has become more scalable. Of course, it may not look feasible when we look at small solutions. When applied to a complex architecture, this principle makes more meaning.</p> <h3># Open Closed Principle</h3> <blockquote>Objects or entities should be open for extension, but closed for modification.</blockquote> <p>Open for extension means that we should be able to add new features or components to the application without breaking existing code. Closed for modification means that we should not introduce breaking changes to existing functionality, because that would force us to refactor a lot of existing code.</p> <p>Changing the current behaviour of a class will affect all the systems using that class. If we want the class to perform more functions, the ideal approach is to add to the functions that already exist not change them.</p> <h3>Advantages</h3> <ul><li>Extensibility</li><li>Maintainability</li><li>Flexibility</li></ul> <h3>Disadvantages</h3> <ul><li>The resource allocator code needs to be unit tested whenever a new resource type is added</li><li>Adding a new resource type introduces considerable risk in the design as almost all aspects of resource allocation have to be modified</li><li>Developer adding a new resource type has to understand the inner workings for the resource allocator</li></ul> <h4>Example</h4> <p>Let’s take a look at the following code:</p> <pre>class Person{<br />  constructor(fullName, language, hobby, education, workplace, position) {<br />    this.fullName = fullName<br />    this.language = language<br />    this.hobby = hobby<br />    this.education = education<br />    this.workplace = workplace<br />    this.position = position<br />  }<br />}<br /><br />class PersonFilter{<br />  filterByName(persons, fullName) {<br />    return persons.filter(person =&gt; person.fullName === fullName)<br />  }<br /><br />  filterBySize(persons, language) {<br />    return persons.filter(person =&gt; person.language === language)<br />  }<br /><br />  filterByHobby(persons, hobby) {<br />    return persons.filter(person =&gt; person.hobby === hobby)<br />  }<br />}</pre> <p>The problem with PersonFilter is that if we want to filter by any other new property we have to change PersonFilter’s code. Let&#39;s solve this problem by creating a filterByProp function which will filter by the properties.</p> <pre>class Person{<br />  constructor(fullName, language, hobby, education, workplace, position) {<br />    this.fullName = fullName<br />    this.language = language<br />    this.hobby = hobby<br />    this.education = education<br />    this.workplace = workplace<br />    this.position = position<br />  }<br />}<br /><br />class GenericFilter{<br />  const filterByProp = (array, propName, value) =&gt;<br />    array.filter(element =&gt; element[propName] === value)<br />}</pre> <h3># Liskov Substitution Principle</h3> <blockquote>If S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the desirable properties of that program.</blockquote> <p>When a child Class cannot perform the same actions as its parent Class, this can cause bugs.</p> <p>If you have a Class and create another Class from it, it becomes a parent and the new Class becomes a child<strong>. </strong>The child Class should be able to do everything the parent Class can do. This process is called Inheritance.</p> <h3>Advantages</h3> <ul><li>It ensures correct sub-hierarchy with relevant checks</li><li>It becomes easy to extend new classes</li><li>The maintainability of code becomes very easy</li><li>There shall be no runtime surprises in the application</li></ul> <h3>Disadvantages</h3> <ul><li>Sometimes we need to update base class in order to support new extension</li><li>You may need to refactor a lot of things</li><li>Cost of refactor</li></ul> <h4>Example</h4> <p>Let’s take a look at the following code:</p> <pre>class Bird {  <br />    fly(){<br />        //..<br />    }<br />}<br /><br />class Eagle extends Bird {<br />    dive(){<br />        //..<br />    }<br />}<br /><br />const eagle = new Eagle();<br />eagle.fly();<br />eagle.dive();<br /><br />class Penguin extends Bird(){<br />   //Problem: Can&#39;t fly! <br />}</pre> <p>The problem is that Penguin can’t fly. So to solve this problem, we have to create separate class for different kind of birds. Let’s look at the following example to solve above problem.</p> <pre>class Bird {<br />  layEgg () {}<br />}<br /><br />class FlyingBird {<br />  fly () {}<br />}<br /><br />class SwimmingBird extends Bird {<br />  swim () {}<br />}<br /><br />class Eagle extends FlyingBird {}<br /><br />class Penguin extends SwimmingBird {}<br /><br />const penguin = new Penguin();<br />penguin.swim();<br />penguin.layEgg();<br /><br />const eagle = new Eagle();<br />eagle.fly();<br />eagle.layEgg();</pre> <h3># Interface Segregation Principle</h3> <blockquote>Clients should not be forced to depend upon interfaces that they do not use.</blockquote> <p>When a Class is required to perform actions that are not useful, it is wasteful and may produce unexpected bugs if the Class does not have the ability to perform those actions.</p> <p>A Class should perform only actions that are needed to fulfil its role. Any other action should be removed completely or moved somewhere else if it might be used by another Class in the future.</p> <h3>Advantages</h3> <ul><li>Faster Compilation</li><li>Reusability</li><li>Maintainability</li><li>Easier to understand</li><li>Lighter to test</li><li>Quicker to change</li></ul> <h3>Disadvantages</h3> <ul><li>You may need to refactor a lot of things</li><li>Cost of refactor</li></ul> <h4>Example</h4> <p>Let’s take a look at the following code:</p> <p>In the following example we have an interface for animals with 2 methods: walk and fly.</p> <p>As you can see, the Dog class has to implement the method fly even though that class does not need it.</p> <pre>interface Animal {<br />  walk(): void;<br />  fly(): void;<br />}<br /><br />class Dog implements Animal {<br />  walk() {<br />    console.log(&quot;Walking&quot;);<br />  }<br /><br />  fly() {<br />    throw new Error(&quot;Dogs cannot fly&quot;);<br />  }<br />}<br /><br />class Duck implements Animal {<br />  walk() {<br />    console.log(&quot;Walking&quot;);<br />  }<br /><br />  fly() {<br />    console.log(&quot;Flying&quot;);<br />  }<br />}</pre> <p>Following this principle we can split the Animal interface into multiple ones. This way, the Dog class will only have to implement the methods that it needs.</p> <pre>interface AnimalCanWalk {<br />  walk(): void;<br />}<br /><br />interface AnimalCanFly {<br />  fly(): void;<br />}<br /><br />class Dog implements AnimalCanWalk {<br />  walk() {<br />    console.log(&quot;Walking&quot;);<br />  }<br />}<br /><br />class Duck implements AnimalCanWalk, AnimalCanFly {<br />  walk() {<br />    console.log(&quot;Walking&quot;);<br />  }<br /><br />  fly() {<br />    console.log(&quot;Flying&quot;);<br />  }<br />}</pre> <h3># Dependency Inversion Principle</h3> <blockquote>High-level modules should not depend on low-level modules. Both should depend on the abstraction.</blockquote> <p>In plain terms, this principle states that your classes should depend upon interfaces or abstract classes instead of concrete classes and functions. This makes your classes open to extension, following the open-closed principle.</p> <h3>Advantages</h3> <ul><li>Your code will not be coupled to external API or other implementations</li><li>Scalable</li><li>Maintainable</li><li>Clean</li></ul> <h3>Disadvantages</h3> <ul><li>You may need to refactor a lot of things</li><li>Cost of refactor</li></ul> <h4>Example</h4> <p>Let’s take a look at the following code:</p> <p>In the following bad example we have the OrderService class that saves orders in a database. The OrderService class depends directly on the low level class MySQL database.</p> <p>If in the future we wanted to change the database that we are using we would have to modify the OrderService class.</p> <pre>class OrderService {<br />  database: MySQLDatabase;<br /><br />  // constructor<br /><br />  save(order: Order): void {<br />    if (order.id === undefined) {<br />      this.database.insert(order);<br />    } else {<br />      this.database.update(order);<br />    }<br />  }<br />}<br /><br />class MySQLDatabase {<br />  insert(order: Order) {<br />    // insert<br />  }<br /><br />  update(order: Order) {<br />    // update<br />  }<br />}</pre> <p>We can improve this by creating an interface and make the OrderService class dependant of it. This way, we are inverting the dependency. Now the high level class depends on an abstraction instead of a low level class.</p> <pre>class OrderService {<br />  database: Database;<br /><br />  // constructor<br /><br />  save(order: Order): void {<br />    this.database.save(order);<br />  }<br />}<br /><br />interface Database {<br />  save(order: Order): void;<br />}<br /><br />class MySQLDatabase implements Database {<br />  save(order: Order) {<br />    if (order.id === undefined) {<br />      // insert<br />    } else {<br />      // update<br />    }<br />  }<br />}</pre> <p>Now we can add new databases without modifying the OrderService class.</p> <h3>Summary</h3> <p>So far, we have discussed five principles with examples in Javascript and Typescript. When you design your architecture, If you ask yourself “Am I violating SOLID principles” , I promise that the quality and scalability of your code will be much better.</p> <p>Thank you so much for reading. I hope you have a better idea about this topic and you had as much fun reading this as I did writing it.</p> <p>If you have any questions or suggestions, leave a comment.</p> <h3>In Plain English 🚀</h3> <p><em>Thank you for being a part of the </em><a href="https://plainenglish.io/"><strong><em>In Plain English</em></strong></a><em> community! Before you go:</em></p> <ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://x.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong>YouTube</strong></a> | <a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a> | <a href="https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0"><strong>Podcast</strong></a></li><li><a href="https://differ.blog/"><strong>Create a free AI-powered blog on Differ.</strong></a></li><li>More content at <a href="https://plainenglish.io/"><strong>PlainEnglish.io</strong></a></li></ul> <p><img src="https://medium.com/_/stat?event=post.clientViewed&amp;referrerSource=full_rss&amp;postId=a28a597888fe" width="1" height="1" alt=""/>&lt;hr&gt;&lt;p&gt;<a href="https://javascript.plainenglish.io/solid-principles-a28a597888fe">SOLID principles made easy — JavaScript &amp; TypeScript</a> was originally published in <a href="https://javascript.plainenglish.io">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.&lt;/p&gt;</p>]]></content><author><name></name></author><category term="typescript"/><category term="javascript"/><category term="solid-principles"/><category term="programming"/><category term="object-oriented"/><category term="medium"/></entry><entry><title type="html">Digitalization in Nepal</title><link href="https://nirajankunwor.com.np/blog/2021/digitalization-in-nepal/" rel="alternate" type="text/html" title="Digitalization in Nepal"/><published>2021-06-09T12:30:03+00:00</published><updated>2021-06-09T12:30:03+00:00</updated><id>https://nirajankunwor.com.np/blog/2021/digitalization-in-nepal</id><content type="html" xml:base="https://nirajankunwor.com.np/blog/2021/digitalization-in-nepal/"><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*KRITRyGSCqLDKuWpvRkdlw.jpeg"/></figure> <p>Sixty-two years after the erstwhile Soviet Union launched Sputnik-1, the world’s first satellite, Nepal sent its first satellite ‘NepaliSat-1’ into space in April 18 to at around 2:31 am. A landlocked country, bordering Tibet of China to the north, and India in the south, east, and west, my country is counted as one of the developing countries of the world . While I was studying in college, I used to watch science fiction movie such as advanced science and technology, space exploration, time travel, and then think how fast the technologies had grown. I used to think ‘Can my country within the Himalayas be so advanced in technologies and digitalization?’. But today I see that we are slowly coming across the dream of digitalization. I realize today that ‘ Rome was not built in a day’ and then we must all contribute to bring the change we wish to see. 2020 brought along a new outlook to this country and a different understanding towards a great deal of things; Digitalization being one of them.</p> <p>The pandemic changed the people’s perspective towards digital payment in Nepal. Although digital payment services had slowly been proceeding towards tentative growth with the innovation in technology, the industry was yet to reach higher ground compared to other countries . We are now quickly adapting and undertaking the usage of digital payment services for our daily expenses and micro payments. Digital payment methods took speed as a way for people as the lockdown was implemented when the Covid-19 virus first hit Nepal; by now people have become more familiar, discovering saved time, lower costs and better client experience. But there’s more trust to be build around these online services as we listen some fraudulent activities. Digitalization also reduced the virus transmissibility through cross contamination.</p> <p>There is a growing level of easiness among local businesses in receiving customer payments contactless and digitally from various payment getaways. Nepalese merchants have now come to the realization that, use of wallet payment services not only reduces the overall transaction cost but also offers customers better security for their payments made, while customers furthermore come to trust their business . Digitalization also allows businesses to gain useful information about their customers and take a customer-centric approach to improve their services. Now, companies are actively participating and supporting digital payment service providers in educating the public on digitized payments, which is another big reason for the swift growth in the industry. Simultaneously, several goverment bodies and banking institutions of Nepal are engaging in promotional activities to encourage cash alternatives like Digital Wallets, QR Code Payments, E-banking and M-banking services.</p> <p>Digital wallet and online payment services play a vital role in this 21st century, as users can, within a few taps on their smartphone, transfer money without the limitations of geographical barriers. Digital wallets grant you the convenience of not having to take your wallet out, nor do you have to count your change, swipe cards or fill out any details before making a transaction. A few taps on your phone and you’re done. Also now the NRB has directed that we can make some international payments putting some restrictions and that start has boosted youths and helped them in making international payments.</p> <p>As the Digital Nepal program estimates to deliver an impact worth 800 million Nepalese rupees ($7.23 million) by 2022, already its IT-enabled services and business process outsourcing sector has been liberalized to allow 100 percent foreign direct investments, while the telecommunication sector allows 80 percent FDI. But Nepal’s ICT infrastructure still remains a work-in-progress. Under the sub-pillar of Infrastructure such as mobile network coverage and bandwidth performance, the WEF’s Network Readiness Index reflected a declining trend for Nepal over the last five years. As Nepal continues to leverage cooperation with multiple countries and not solely relying on India to strengthen its technological capacities, its policymakers and business communities must start capitalizing on Nepal’s growing ICT facilities — forming linkages between its satellite, optic cables, and upcoming 5G networks can bring Nepal one step further to integrate with the global digital economy.</p> <blockquote>Wrap Up:</blockquote> <p>Although, 2020 was a difficult year for all of us in every aspect and with the next wave of covid-19 , 2021 is also not going as expected. but we must adapt everyday to a new way of life, because it is during the darkest moment that we must focus to see the light and the light is digitalization and digital payment in Nepal which might just bring a revolution in our country.</p> <p><img src="https://medium.com/_/stat?event=post.clientViewed&amp;referrerSource=full_rss&amp;postId=3f29146b6702" width="1" height="1" alt=""/></p>]]></content><author><name></name></author><category term="digitalization"/><category term="future"/><category term="medium"/></entry><entry><title type="html">The Best Programming Languages to learn in 2021</title><link href="https://nirajankunwor.com.np/blog/2021/the-best-programming-languages-to-learn-in-2021/" rel="alternate" type="text/html" title="The Best Programming Languages to learn in 2021"/><published>2021-06-08T03:23:07+00:00</published><updated>2021-06-08T03:23:07+00:00</updated><id>https://nirajankunwor.com.np/blog/2021/the-best-programming-languages-to-learn-in-2021</id><content type="html" xml:base="https://nirajankunwor.com.np/blog/2021/the-best-programming-languages-to-learn-in-2021/"><![CDATA[<p>Coding languages are evolving faster than any other area. Technologies have grown so much and developed so fast that even the slowest programming languages have been faster due to advancement in technology. For a tech newbie striving to learn programming, there are few languages I can suggest. But it is always about passion so find out what your heart is keen to learn.</p> <h3><strong><em>Top 3 Programming languages to learn</em></strong></h3> <h4><strong>Java</strong></h4> <figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*gro5YaCodNJF_Y5YeR4LIA.jpeg"/></figure> <p><strong>Platform: </strong>Web, Mobile, Desktop</p> <p><strong>Annual Salary Projection:</strong> around $ 79000</p> <p><strong>Description: </strong>Java is a high-level, class-based, object oriented programming language that is designed to have as few implementation dependencies as possible. It is a general-purpose programming language intended to let application developer <em>write once, run anywhere</em> (WORA), meaning that compiled Java code can run on all platforms that support Java without the need for recompilation</p> <p><strong>Why Java?</strong></p> <p>The answer to this question comprises of multiple reasons like its popularity, ease-to-learn nature, helpful open source tools and libraries etc. Gaining expertise in Java ensures a secure career with fat paychecks and the power to create applications with real-world applications.</p> <h4>Python</h4> <figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*DMuGlawUCN_6yHt2wRAKhQ.png"/></figure> <p><strong>Platform: </strong>Web, Desktop</p> <p><strong>Annual Salary Projection:</strong> Around $75,000</p> <p><strong>Description:</strong>Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together.</p> <p><strong>Why Python?</strong></p> <p>Python is easy to use, powerful, and versatile, making it a great choice for beginners and experts alike. Python’s readability makes it a great first programming language — it allows you to think like a programmer and not waste time with confusing syntax. But don’t think that because Python is easy to use it’s a wimpy language. Python is incredibly powerful — there’s a reason companies like Google, Dropbox, Spotify, and Netflix use it.</p> <h4>JavaScript</h4> <figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*lrM9OZA_5r2sGthYAP1JZA.jpeg"/></figure> <p><strong>Platform:</strong> Web, Mobile, Desktop</p> <p><strong>Annual Salary Projection: </strong>around $81000</p> <p><strong>Description: </strong>JavaScript is a cross-platform, object-oriented scripting language used to make webpages interactive (e.g., having complex animations, clickable buttons, popup menus, etc.). There are also more advanced server side versions of JavaScript such as Node.js, which allow you to add more functionality to a website than downloading files (such as real time collaboration between multiple computers). Inside a host environment (for example, a web browser), JavaScript can be connected to the objects of its environment to provide programmatic control over them.</p> <p><strong>Why JavaScript?</strong></p> <p>Today, JavaScript is one of the most powerful languages on the planet because of its performance and omnipresence. Personally, I feel like JavaScript has the potential to tap into so many popular industries like Machine Learning and Data Analysis, where Python still rules the game. It’s even happening now with tools like Tensorflow.js! Of course, nothing really beats C/C++/Rust, but JavaScript is a fast — in the sense that V8 can generate highly optimized code by monitoring how your code executes, delaying the bits of execution which are not used, and optimizing the code segments which are used over and over. JavaScript (Node) is highly scalable (with supersets like TypeScript). Running on a single threaded architecture, people often criticize Node for its lack of threading environment, but the reality is it doesn’t matter a lot.</p> <p><strong>Wrap up</strong></p> <p>There are many options for a newbie to learn programming. As well as there are hundreds of code languages to start with. But the ones reviewed here are the world’s top-rated technologies and they remain this way for years. So, I think this will help you and you will find a way to contribute to this industry.</p> <p><img src="https://medium.com/_/stat?event=post.clientViewed&amp;referrerSource=full_rss&amp;postId=a958fd683a39" width="1" height="1" alt=""/></p>]]></content><author><name></name></author><category term="newbie-programmer"/><category term="2021-programming"/><category term="top-programming-languages"/><category term="programming"/><category term="best-programming-language"/><category term="medium"/></entry></feed>