<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Shawn2208</title>
    <description>The latest articles on Forem by Shawn2208 (@shawn2208).</description>
    <link>https://forem.com/shawn2208</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1027362%2Fad64bd79-c384-4e95-bb77-2a0104b13cd7.jpg</url>
      <title>Forem: Shawn2208</title>
      <link>https://forem.com/shawn2208</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/shawn2208"/>
    <language>en</language>
    <item>
      <title>Tutorial on making a database and then using my API-Template from GIT</title>
      <dc:creator>Shawn2208</dc:creator>
      <pubDate>Sun, 25 Feb 2024 20:18:46 +0000</pubDate>
      <link>https://forem.com/shawn2208/tutorial-on-making-a-database-and-then-using-my-api-template-from-git-54h1</link>
      <guid>https://forem.com/shawn2208/tutorial-on-making-a-database-and-then-using-my-api-template-from-git-54h1</guid>
      <description>&lt;p&gt;Creating an account and setting up a database with a collection on MongoDB Atlas involves a series of straightforward steps. MongoDB Atlas is a cloud database service that provides you with a hosted MongoDB service, making it easier to set up, operate, and scale your databases. Here's a step-by-step guide you can follow for your tutorial:&lt;/p&gt;

&lt;p&gt;Step 1: Sign Up for MongoDB Atlas&lt;/p&gt;

&lt;p&gt;Go to the MongoDB Atlas website: Open your web browser and navigate to the MongoDB Atlas website.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.mongodb.com/cloud/atlas/register"&gt;https://www.mongodb.com/cloud/atlas/register&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create an account: Click on the "Start Free" or "Sign Up" button. You will need to provide your email, create a password, and fill out any other required information.&lt;/p&gt;

&lt;p&gt;Verify your email: After signing up, check your email for a verification message from MongoDB Atlas and follow the instructions to verify your email address.&lt;/p&gt;

&lt;p&gt;Step 2: Create a Cluster&lt;/p&gt;

&lt;p&gt;Log in to your MongoDB Atlas dashboard: After email verification, log in to your MongoDB Atlas account.&lt;/p&gt;

&lt;p&gt;Create a new cluster: Click on the "Build a Cluster" button. You can choose a free tier cluster for testing purposes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvly2127507iigmh48osf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvly2127507iigmh48osf.png" alt="Image description" width="800" height="376"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 3: Configure Security Settings&lt;br&gt;
Create a database user: Navigate to the "Database Access" section under "Security". Click "Add New Database User", and create a user with read and write privileges to any database. Remember the username and password, as you will need them to connect to your database.&lt;/p&gt;

&lt;p&gt;Whitelist your IP address: In the "Network Access" section, add your current IP address to the IP whitelist to allow connections from your location, &lt;/p&gt;

&lt;p&gt;Click on "Finish and Close"&lt;/p&gt;

&lt;p&gt;Now you will be taken to this page &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6nukc2mr5zdaa114ryzg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6nukc2mr5zdaa114ryzg.png" alt="Image description" width="800" height="339"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click connect&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc3dj9ymjcar55koojejf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc3dj9ymjcar55koojejf.png" alt="Image description" width="800" height="303"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you will need to click on drivers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F10m94u73hd6rx4teflnn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F10m94u73hd6rx4teflnn.png" alt="Image description" width="800" height="290"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will now need to copy that mongodv+serv string click on the copy icon the right of it. &lt;/p&gt;

&lt;p&gt;Then after that for put that string in a .env file should look like this &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ue4tjis4fz8x3yuo0tv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ue4tjis4fz8x3yuo0tv.png" alt="Image description" width="800" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For now just go back to atlas and click on the "Add Data "&lt;/p&gt;

&lt;p&gt;Then Click on the button "start" Create Database on Atlas&lt;br&gt;
Add data directly in the Atlas interface.&lt;/p&gt;

&lt;p&gt;Now Type in the database name Generic and the collection name GenericModel scroll a little bit down and click on "Create Database" button.&lt;/p&gt;

&lt;p&gt;Should now be on this screen &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F94zxos8aainn1lh88u7z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F94zxos8aainn1lh88u7z.png" alt="Image description" width="800" height="290"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now go back to your VSCode i am just assuming you're using that.&lt;br&gt;
In your .env file need to adjust the string from this &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe26sm39gje9krs6l7e7a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe26sm39gje9krs6l7e7a.png" alt="Image description" width="800" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To This &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fboxk3djx4xp4vfsnijqf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fboxk3djx4xp4vfsnijqf.png" alt="Image description" width="800" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Clone the GitHub Repository&lt;/p&gt;

&lt;p&gt;Open Terminal or Command Prompt: Access your terminal on macOS/Linux or Command Prompt/Powershell on Windows.&lt;/p&gt;

&lt;p&gt;Navigate to your project directory: Use the cd command to navigate to the folder where you want to clone the repository.&lt;/p&gt;

&lt;p&gt;cd path/to/your/project/directory&lt;br&gt;
Clone the repository: Execute the following command to clone the repository:&lt;/p&gt;

&lt;p&gt;git clone &lt;a href="https://github.com/Shawn2208/API-Template.git"&gt;https://github.com/Shawn2208/API-Template.git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Navigate to the cloned directory: Once the cloning process is complete, move into the cloned repository's directory:&lt;/p&gt;

&lt;p&gt;cd API-Template&lt;/p&gt;

&lt;p&gt;Now just type in the terminal code .env a file should pop up now just put that string inside this file.&lt;/p&gt;

&lt;p&gt;You will also need to run &lt;/p&gt;

&lt;p&gt;npm install &lt;/p&gt;

&lt;p&gt;In your terminal installing all the necessary dependencies.&lt;/p&gt;

&lt;p&gt;Run: &lt;/p&gt;

&lt;p&gt;node server.js&lt;/p&gt;

&lt;p&gt;If you have followed this correctly it will tell you mongodb is connected and the localhost:3000 now the endpoint is:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://localhost:3000/api/endpoint"&gt;http://localhost:3000/api/endpoint&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It will be blank cause you have no data in your database.&lt;/p&gt;

&lt;p&gt;As you proceed to develop this application further, consider exploring more advanced features of MongoDB Atlas such as data encryption, automated backups, and performance monitoring to ensure your application remains robust, secure, and performant.&lt;/p&gt;

&lt;p&gt;And also have a look at the README.md file more info is in there.&lt;/p&gt;

&lt;p&gt;Give us a like or comment your thought's maybe next i will show you in depth with what needs to be renamed and etc in the API folder.&lt;/p&gt;

&lt;p&gt;In conclusion, this tutorial has guided you through the essential steps of setting up a MongoDB Atlas account, creating and configuring a database cluster, and integrating it with an application by cloning a GitHub repository and configuring the connection string within a .env file. From signing up for MongoDB Atlas, securing your database with a user and IP whitelist, to creating a database and collection named Generic and GenericModel, respectively, you have learned the foundational steps necessary to leverage MongoDB Atlas for cloud-based database management.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Building a Maze Game in Node.js</title>
      <dc:creator>Shawn2208</dc:creator>
      <pubDate>Fri, 02 Feb 2024 15:43:18 +0000</pubDate>
      <link>https://forem.com/shawn2208/building-a-maze-game-in-nodejs-4j7m</link>
      <guid>https://forem.com/shawn2208/building-a-maze-game-in-nodejs-4j7m</guid>
      <description>&lt;p&gt;Hi in this tutorial i will show you how to create a simple maze game in Node.js. The player will have to navigate through a field of holes to find their hat or whatever you want it to be without falling into any holes. This project is ideal for people that have a basic understanding of JavaScript and wanting to grow you're skills.&lt;/p&gt;

&lt;p&gt;Before we start coding, here's what you need to know:&lt;/p&gt;

&lt;p&gt;No External Dependencies: This game uses only Node.js. There are no external libraries or frameworks to install.&lt;br&gt;
Single File Setup: The entire game is contained within a single JavaScript file.&lt;br&gt;
Pre-requisites: Ensure you have Node.js installed on your computer. You can download it from Node.js official website if it's not already installed.&lt;/p&gt;

&lt;p&gt;All you need to do is create a new JavaScript file (mazeGame.js) and follow along with this tutorial.&lt;/p&gt;

&lt;p&gt;Step 1: Setting Up&lt;br&gt;
First, we need to import the readline module to handle command line input:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const readline = require('readline');

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 2: Defining the Game Characters&lt;br&gt;
We'll use different characters to represent elements in the game:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const hat = '^';          // The hat
const hole = 'O';         // The holes
const fieldCharacter = '░';  // Open field
const pathCharacter = '*';   // The path taken

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 3: Creating the Field&lt;br&gt;
The initializeField function generates the maze:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function initializeField(height, width, percentage) {
  // Create a 2D array representing the field
  const field = new Array(height).fill(0).map(el =&amp;gt; new Array(width));

  // Fill the field with holes and open spaces
  for (let y = 0; y &amp;lt; height; y++) {
    for (let x = 0; x &amp;lt; width; x++) {
      const prob = Math.random();
      field[y][x] = prob &amp;gt; percentage ? fieldCharacter : hole;
    }
  }
  return field;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 4: Placing the Hat&lt;br&gt;
The setHatLocation function places the hat randomly in the field:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function setHatLocation(field, height, width) {
  let hatLocation;

  // Ensure the hat is not at the starting position
  do {
    hatLocation = {
      x: Math.floor(Math.random() * width),
      y: Math.floor(Math.random() * height)
    };
  } while (hatLocation.x === 0 &amp;amp;&amp;amp; hatLocation.y === 0);

  field[hatLocation.y][hatLocation.x] = hat;
  return field;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 5: Displaying the Field&lt;br&gt;
The printField function prints the current state of the field:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function printField(field) {
  const displayString = field.map(row =&amp;gt; row.join('')).join('\n');
  console.log(displayString);
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 6: Running the Game&lt;br&gt;
The runGame function contains the main game loop:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Main function to run the game.
function runGame(field) {
  let locationX = 0;
  let locationY = 0;
  field[0][0] = pathCharacter; // Set the starting point.

  let playing = true;
  printField(field);

  // Initialize readline interface for user input.
  const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
  });

  // Function to handle user input.
  const handleInput = (answer) =&amp;gt; {
    field[locationY][locationX] = fieldCharacter; // Clear the previous path character.

    // Move the player based on input.
    switch (answer.toUpperCase()) {
      case 'U':
        locationY -= 1;
        break;
      case 'D':
        locationY += 1;
        break;
      case 'L':
        locationX -= 1;
        break;
      case 'R':
        locationX += 1;
        break;
      default:
        console.log('Enter U, D, L, or R.');
        rl.prompt();
        return;
    }

    // Check for various conditions (out of bounds, falling in a hole, finding the hat).
    if (!isInBounds(field, locationX, locationY)) {
      console.log('Out of bounds instruction!');
      playing = false;
    } else if (isHole(field, locationX, locationY)) {
      console.log('Sorry, you fell down a hole!');
      playing = false;
    } else if (isHat(field, locationX, locationY)) {
      console.log('Congrats, you found your hat!');
      playing = false;
    }

    // Continue the game or end it based on the player's state.
    if (playing) {
      field[locationY][locationX] = pathCharacter;
      printField(field);
      rl.prompt();
    } else {
      rl.close();
    }
  };

  // Set up readline to listen for user input.
  rl.on('line', handleInput);
  rl.setPrompt('Which way? ');
  rl.prompt();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 7: Helper Functions&lt;br&gt;
We use isInBounds, isHat, and isHole to check the player's status:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Helper functions to check the player's state.
function isInBounds(field, x, y) {
  return y &amp;gt;= 0 &amp;amp;&amp;amp; x &amp;gt;= 0 &amp;amp;&amp;amp; y &amp;lt; field.length &amp;amp;&amp;amp; x &amp;lt; field[0].length;
}

function isHat(field, x, y) {
  return field[y][x] === hat;
}

function isHole(field, x, y) {
  return field[y][x] === hole;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 8: Starting the Game&lt;br&gt;
Finally, we initialize the game with the field size and start it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Game settings.
const height = 10;
const width = 10;
const percentage = 0.2;

// Initialize the game field and start the game.
const myField = setHatLocation(initializeField(height, width, percentage), height, width);
runGame(myField);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There you have it only about 130 lines of code and it's a fun game to play and also make and build on it make it you're own and i hope this improves you're skills. Feel free to comment on how you have built on it and made it bigger and better.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Mastering the While Loop in JavaScript</title>
      <dc:creator>Shawn2208</dc:creator>
      <pubDate>Sat, 23 Dec 2023 18:17:54 +0000</pubDate>
      <link>https://forem.com/shawn2208/mastering-the-while-loop-in-javascript-4ddj</link>
      <guid>https://forem.com/shawn2208/mastering-the-while-loop-in-javascript-4ddj</guid>
      <description>&lt;p&gt;Introduction:&lt;br&gt;
Every aspiring JavaScript developer must understand the while loop, a fundamental tool for handling repetitive tasks. This article aims to simplify the while loop, guiding you through its construction step by step.&lt;/p&gt;

&lt;p&gt;Anatomy of a While Loop:&lt;br&gt;
A while loop in JavaScript typically includes:&lt;/p&gt;

&lt;p&gt;Condition: Determines how long the loop should run.&lt;/p&gt;

&lt;p&gt;Loop Actions: The code that executes on each iteration.&lt;/p&gt;

&lt;p&gt;Counter Update: Modifies the loop variable (if necessary).&lt;/p&gt;

&lt;p&gt;Step-by-Step Guide to Constructing a While Loop:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Step 1: Initialization Phase (Outside the Loop)
let i = 0;  // Initialize the loop counter or any necessary variables outside the loop.

// Step 2: Begin with the Keyword
while (

    // Step 3: Open Parentheses - this is done automatically by the syntax of the 'while' loop.

    // Step 4: Set the Condition
    i &amp;lt; 10  // The loop will continue to run as long as this condition is true. Here, it runs as long as 'i' is less than 10.

    // Step 5: Close Parentheses and Open Curly Braces - done automatically by the syntax.
) {

    // Step 6: Specify Loop Actions
    console.log(i);  // During each iteration, we'll print the current value of 'i' to the console.

    // Step 7: Update the Loop Counter
    i++  // After each iteration, increase the value of 'i' by 1.

    // Step 8: Close Curly Braces - will be done after specifying all the actions inside the loop.
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Common Pitfalls and Tips:&lt;/p&gt;

&lt;p&gt;Infinite Loops: The most common mistake is creating an infinite loop. Ensure that the loop condition will eventually become false.&lt;/p&gt;

&lt;p&gt;Counter Management: If using a counter, initialize it before the loop and update it correctly within the loop.&lt;/p&gt;

&lt;p&gt;Condition Relevance: Make sure the condition is relevant to the loop's purpose and changes appropriately with each iteration.&lt;/p&gt;

&lt;p&gt;Conclusion:&lt;br&gt;
The while loop is an essential element in JavaScript, offering a straightforward way to handle repetitive tasks. With practice, you'll gain proficiency in using while loops, enhancing your JavaScript programming skills. Experiment with different scenarios and see how while loops can simplify your code.&lt;/p&gt;

&lt;p&gt;Questions or Further Discussion:&lt;br&gt;
If you have any questions or would like an in-depth discussion on other JavaScript concepts, feel free to drop a comment. &lt;/p&gt;

&lt;p&gt;Also i appreciate my followers patience recently. I've been dedicated to building a full-stack e-commerce agency website, featuring custom templates developed in React &amp;amp; my freelance services i will be offering, secure PayPal payment integration, and reliable AWS storage solutions. This project is designed to offer mostly react websites for my potential customers. I'm excited about the upcoming launch and appreciate your support during this busy but rewarding time.&lt;/p&gt;

&lt;p&gt;Stay tuned for more updates!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>codenewbie</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Mastering the For Loop in JavaScript</title>
      <dc:creator>Shawn2208</dc:creator>
      <pubDate>Fri, 22 Sep 2023 11:43:03 +0000</pubDate>
      <link>https://forem.com/shawn2208/mastering-the-for-loop-in-javascript-1i</link>
      <guid>https://forem.com/shawn2208/mastering-the-for-loop-in-javascript-1i</guid>
      <description>&lt;p&gt;Introduction:&lt;br&gt;
Every aspiring JavaScript developer encounters the for loop early in their learning journey. This loop is a versatile tool, crucial for tasks that require repetition. In this article, we'll break down the process of constructing a for loop, step by step.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Step 1: Begin with the Keyword
for (
    // Step 2: Open Parentheses - this is done automatically by the syntax of the 'for' loop.

    // Step 3: Initialization Phase
    let i = 0;  // We're setting our starting point with the variable 'i' initialized to 0.

    // Step 4: Set the Condition
    i &amp;lt; 10;  // The loop will continue to run as long as this condition is true. In this case, as long as 'i' is less than 10.

    // Step 5: Update the Loop Counter
    i++  // After each iteration, we increase the value of 'i' by 1.
) {
    // Step 6: Close Parentheses and Open Curly Braces - done automatically by the syntax.

    // Step 7: Specify Loop Actions
    console.log(i);  // During each iteration, we'll print the current value of 'i' to the console.

    // Step 8: Close Curly Braces - will be done after specifying all the actions inside the loop.
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Anatomy of a For Loop:&lt;br&gt;
A for loop has three main components:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Initialization - Setting the starting point.&lt;/li&gt;
&lt;li&gt;Condition - Determining how long the loop should run.&lt;/li&gt;
&lt;li&gt;Update - Modifying the loop variable after each iteration.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Step-by-Step Initialization:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Begin with the Keyword: Start with "for", indicating the start of your loop.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open Parentheses: Place an open parenthesis "(" right after.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Initialization Phase: Set a starting point, typically using a variable like "i" set to "0".&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set the Condition: Use a condition to determine the loop's end. E.g., if iterating over 10 items, check if "i" is less than 10.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update the Loop Counter: After the condition, state how the loop variable changes, commonly increasing "i" by 1.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Close Parentheses and Open Curly Braces: Seal off the setup and begin defining the loop's actions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Specify Loop Actions: Within the braces, detail the tasks for each iteration.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Close Curly Braces: Conclude the loop.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Common Pitfalls and Tips:&lt;/p&gt;

&lt;p&gt;Endless Loops: Ensure your condition eventually becomes false; otherwise, the loop will run indefinitely.&lt;/p&gt;

&lt;p&gt;Variable Naming: While "i" is conventional, always choose descriptive variable names for clarity.&lt;/p&gt;

&lt;p&gt;Nested Loops: When using loops inside loops, be careful with variable names to avoid conflicts.&lt;/p&gt;

&lt;p&gt;Conclusion:&lt;br&gt;
The for loop is foundational in JavaScript, providing an efficient way to perform repetitive tasks. By mastering its structure, you're one step closer to becoming a proficient JavaScript developer. Dive in, practice, and soon you'll be crafting loops with ease!&lt;br&gt;&lt;br&gt;
If you have any questions or want me to go in depth with other concepts please drop a comment.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>codenewbie</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>3 Comprehensive Guides from Rheinwerk Computing Every Developer Must Read</title>
      <dc:creator>Shawn2208</dc:creator>
      <pubDate>Wed, 13 Sep 2023 13:52:28 +0000</pubDate>
      <link>https://forem.com/shawn2208/3-comprehensive-guides-from-rheinwerk-computing-every-developer-must-read-5640</link>
      <guid>https://forem.com/shawn2208/3-comprehensive-guides-from-rheinwerk-computing-every-developer-must-read-5640</guid>
      <description>&lt;p&gt;Today, I'm going to introduce you to three game-changing books from Rheinwerk Computing that promise to be transformative for any developer, whether you're just starting out or already miles into your coding journey.&lt;/p&gt;

&lt;p&gt;My Personal Experience: The Chat App called connect-codechat!&lt;/p&gt;

&lt;p&gt;I recently developed a real-time chat application for developers called connect-codechat, which is live at &lt;a href="https://www.connectcodechat.co.uk"&gt;https://www.connectcodechat.co.uk&lt;/a&gt; connect-codechat provides a platform for developers to collaborate and get help in real-time, as an alternative to posting on forums and waiting hours or days for responses.&lt;/p&gt;

&lt;p&gt;Embarking on this solo full stack project using HTML, CSS, Bootstrap, JavaScript, Node.js, EJS, Express, bcrypt, socket.io, and MongoDB was an invaluable learning experience. With determination and the comprehensive Rheinwerk programming guides as my reference, I succeeded in architecting and implementing the front and back end components. Now that it's complete, I'm excited to have a fully functioning chat app in my portfolio that demonstrates both my coding skills and ability to independently build an app from ideation to deployment.&lt;/p&gt;

&lt;p&gt;The sense of accomplishment from developing DevConnect has given me confidence that with the right resources, I can achieve my goal of becoming a Full Stack JavaScript Developer. I look forward to applying what I've learned on even more ambitious projects.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;HTML and CSS:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvv5wxzaldigspctdlny4.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvv5wxzaldigspctdlny4.jpeg" alt="Image description" width="716" height="1024"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Overview: Rheinwerk’s guide on HTML and CSS serves as an encyclopedia of modern web design. The book offers an extensive dive into the intricacies of these foundational languages.&lt;/p&gt;

&lt;p&gt;Why it's a must-read: In an era where user experience can make or break platforms, understanding the nuances of HTML and CSS becomes paramount. This book ensures you grasp not just the basics, but also the best practices, optimizations, and the latest features.&lt;/p&gt;

&lt;p&gt;Key Takeaways:&lt;/p&gt;

&lt;p&gt;The evolution of grid layouts and flexbox.&lt;br&gt;
Ensuring accessibility in web designs.&lt;br&gt;
Responsive designs across different devices.&lt;/p&gt;

&lt;p&gt;Highlights Include:&lt;br&gt;
HTML syntax and structure&lt;br&gt;
HTML elements&lt;br&gt;
HTML forms&lt;br&gt;
Tables, links, and images&lt;br&gt;
CCS selectors&lt;br&gt;
CSS box model&lt;br&gt;
CSS preprocessors&lt;br&gt;
Cascade and inheritance&lt;br&gt;
Responsive layout design&lt;br&gt;
Javascript&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;JavaScript:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnrmph70nvz47i3kinnrg.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnrmph70nvz47i3kinnrg.jpeg" alt="Image description" width="716" height="1024"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Overview: This isn’t your ordinary JavaScript guide. Rheinwerk’s version ensures you’re well-equipped to navigate the complex landscape of one of the web’s most versatile languages.&lt;/p&gt;

&lt;p&gt;Why it's a must-read: Given JavaScript's omnipresence in modern web applications, a developer's proficiency in this language can be a significant edge. This guide transitions you from a novice to an expert, encompassing both foundational and intricate JavaScript concepts.&lt;/p&gt;

&lt;p&gt;Key Takeaways:&lt;/p&gt;

&lt;p&gt;Deep dives into asynchronous operations and promises.&lt;br&gt;
Best practices for clean and efficient code.&lt;br&gt;
Exploring the potential of ES6 and beyond.&lt;/p&gt;

&lt;p&gt;Highlights include:&lt;br&gt;
Reference types&lt;br&gt;
Objects&lt;br&gt;
Events&lt;br&gt;
Forms&lt;br&gt;
Web Api&lt;br&gt;
jQuery&lt;br&gt;
Object-oriented programming&lt;br&gt;
Functional programming&lt;br&gt;
Client-side applications&lt;br&gt;
Server-side applications&lt;br&gt;
Mobile and desktop applications&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Node.js:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fma6jfueqb3awmbuw8n8y.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fma6jfueqb3awmbuw8n8y.jpeg" alt="Image description" width="716" height="1024"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Overview: Backend development is undergoing a revolution, with Node.js leading the charge. This Rheinwerk guide is your passport to mastering backend development using JavaScript.&lt;/p&gt;

&lt;p&gt;Why it's a must-read: Node.js is rewriting the rules of backend development, allowing for highly scalable and efficient applications. With the rise of real-time applications and a shift towards a more interconnected web, understanding Node.js is no longer just an advantage—it's essential.&lt;/p&gt;

&lt;p&gt;Key Takeaways:&lt;/p&gt;

&lt;p&gt;Building scalable architectures with microservices.&lt;br&gt;
Effective database integrations.&lt;br&gt;
Ensuring application security and best practices.&lt;/p&gt;

&lt;p&gt;Highlights include:&lt;br&gt;
Installation&lt;br&gt;
Web development&lt;br&gt;
Asynchronous programming&lt;br&gt;
Modules&lt;br&gt;
Express and Nest&lt;br&gt;
Template Engines&lt;br&gt;
Database connectivity&lt;br&gt;
Web sockets&lt;br&gt;
Command line applications&lt;br&gt;
Deployment and operations&lt;br&gt;
Security&lt;br&gt;
Testing and performance&lt;/p&gt;

&lt;p&gt;In Conclusion: With these three guides from Rheinwerk Computing, you're not just adding to your knowledge – you're amplifying your prowess as a developer. Dive into them, absorb their insights, and watch as they revolutionize your coding approach.&lt;br&gt;
I'll also include link to the books &lt;a href="https://www.sap-press.com/programming/general-computing/"&gt;https://www.sap-press.com/programming/general-computing/&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;What's your go-to coding resource? Have you read any of these guides? Share your thoughts and let’s keep the learning curve ascending!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>node</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Introducing connect-codechat: A Real-time Chat App Built with Express &amp; Node.js socket.io</title>
      <dc:creator>Shawn2208</dc:creator>
      <pubDate>Tue, 05 Sep 2023 11:11:11 +0000</pubDate>
      <link>https://forem.com/shawn2208/introducing-devconnect-a-real-time-chat-app-built-with-express-nodejs-17dj</link>
      <guid>https://forem.com/shawn2208/introducing-devconnect-a-real-time-chat-app-built-with-express-nodejs-17dj</guid>
      <description>&lt;p&gt;&lt;a href="https://connect-codechat-4c2d444b36df.herokuapp.com/"&gt;https://connect-codechat-4c2d444b36df.herokuapp.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Make an account and get collaborating 😊&lt;/p&gt;

&lt;p&gt;Hi, DEV Community! I'm excited to share a project I've been working on - connect-codechat, a real-time chat app. My journey with this app has been both challenging and rewarding, and today, I want to walk you through the tech stack and some of the choices I made.&lt;/p&gt;

&lt;p&gt;Tech Stack Breakdown:&lt;/p&gt;

&lt;p&gt;1 ) Node.js &amp;amp; Express: The backbone of connect-codechat. Express, being a minimalist web framework for Node.js, provided me the foundation to build the backend functionalities smoothly.&lt;/p&gt;

&lt;p&gt;2 ) EJS: I used the Embedded JavaScript templating language to generate dynamic HTML content with plain JavaScript. It seamlessly integrates with Express, allowing for efficient view rendering.&lt;/p&gt;

&lt;p&gt;3 ) MongoDB &amp;amp; Mongoose: For data storage, I opted for MongoDB and interfaced with it using Mongoose. This combination streamlined database operations, from defining schemas to querying data.&lt;/p&gt;

&lt;p&gt;4 ) Real-time Communication: One of the highlights of connect-codechat is its real-time chat capabilities, made possible by Socket.io. This library enables bidirectional and event-based communication, providing users with an interactive chatting experience.&lt;/p&gt;

&lt;p&gt;5 ) User Authentication: With Passport and its local strategy, connect-codechat ensures secure user authentication. Registering and logging in users are crucial functionalities, and with bcrypt, passwords are securely hashed to maintain user privacy.&lt;/p&gt;

&lt;p&gt;6 ) Middleware &amp;amp; Utilities: Incorporating other vital packages like body-parser, connect-flash, express-session, and cors allowed for a richer development experience. Each package played its role, from parsing incoming request bodies to enabling CORS and managing sessions.&lt;/p&gt;

&lt;p&gt;The Development Journey:&lt;/p&gt;

&lt;p&gt;The idea for connect-codechat emerged from a very personal pain point. Often, when seeking answers to pressing coding queries, I'd find myself waiting for hours on platforms like Stack Overflow, refreshing the page in hopes of a timely response. This experience sparked a thought: Why not create a real-time chat platform like Stack Overflow? A platform where, if numerous users are online, you're guaranteed a prompt answer. And then, the journey to building connect-codechat began.&lt;/p&gt;

&lt;p&gt;Throughout this journey, there were several obstacles to navigate. One significant challenge I encountered was ensuring messages sent in a specific JavaScript room remained confined to that room. An oversight would mean that messages could be broadcasted to other rooms, a functionality that would defeat the very purpose of having topic-specific rooms. This bug became a major roadblock. However, after taking a brief break to rejuvenate my perspective, I revisited the issue. To my surprise, I realized I had missed just four crucial lines of code! links to these 4 lines:&lt;br&gt;
&lt;a href="https://imgur.com/Z30uQUJ"&gt;https://imgur.com/Z30uQUJ&lt;/a&gt;&lt;br&gt;
&lt;a href="https://imgur.com/swgGVT2"&gt;https://imgur.com/swgGVT2&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Such moments, while seemingly minor, underscore the larger narrative of software development: it's as much about personal growth as it is about technical prowess. The euphoria I felt upon resolving this seemingly small issue was indescribable. It wasn't just about overcoming a coding challenge; it was the realization that every hurdle, every roadblock, serves as an opportunity for growth. If we never stumble, how can we ever learn to pick ourselves up and innovate?&lt;/p&gt;

&lt;p&gt;As I've come to appreciate, the problem's aren't just obstacles — they're learning opportunities. And every time we learn from a mistake, we inch closer to becoming not just better developers but more resilient problem solvers.&lt;/p&gt;

&lt;p&gt;Conclusion:&lt;/p&gt;

&lt;p&gt;Building connect-codechat was not just about creating a chat app, but about embracing a comprehensive learning experience. From ensuring real-time communication to securing user data, every step was a lesson. I'm eager to hear your feedback and suggestions!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>node</category>
      <category>database</category>
    </item>
    <item>
      <title>Building a Mini Text-Based Adventure Game: "Mini Zork" with HTML, CSS, JS</title>
      <dc:creator>Shawn2208</dc:creator>
      <pubDate>Sat, 02 Sep 2023 20:16:17 +0000</pubDate>
      <link>https://forem.com/shawn2208/building-a-mini-text-based-adventure-game-mini-zork-with-html-css-js-3879</link>
      <guid>https://forem.com/shawn2208/building-a-mini-text-based-adventure-game-mini-zork-with-html-css-js-3879</guid>
      <description>&lt;p&gt;Ever played a text-based game? These games, which date back to the early days of computing, have always fascinated me with their simplicity yet immersive nature. Today, I'm going to introduce you to "Mini Zork", a simple text-based game built using HTML, CSS, and JavaScript. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The HTML Structure:
The structure is straightforward. We have a terminal div with an output section for game feedback and an input section to receive commands from the player:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;link rel="stylesheet" href="styles.css"&amp;gt;
    &amp;lt;title&amp;gt;Mini Zork&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;div id="terminal"&amp;gt;
        &amp;lt;div id="output"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div id="input-line"&amp;gt;
            &amp;lt;span class="prompt"&amp;gt;$&amp;gt;&amp;lt;/span&amp;gt;
            &amp;lt;input type="text" id="input" autofocus&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;

    &amp;lt;script src="app.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Game Logic with JavaScript:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const inputEl = document.getElementById('input');
const outputEl = document.getElementById('output');

inputEl.focus();
inputEl.addEventListener('keydown', (event) =&amp;gt; {
    if (event.key === 'Enter') {
        const command = inputEl.value;
        handleCommand(command);
        inputEl.value = '';
    }
});

let currentRoom = 'start';

const rooms = {
    start: {
        description: "You are in a dark room. There is a door to the north.",
        exits: {north: 'hallway'},
    },
    hallway: {
        description: "You are in a long hallway. There is a door to the south and another one to the east.",
        exits: {south: 'start', east: 'treasureRoom'},
    },
    treasureRoom: {
        description: "You've found the treasure room! There's a massive chest in the center. Congratulations!",
        exits: {west: 'hallway'},
    }
};

function handleCommand(command) {
    let output = '';

    switch(command) {
        case 'look':
            output = rooms[currentRoom].description;
            break;

        case 'go north':
            if(rooms[currentRoom].exits.north) {
                currentRoom = rooms[currentRoom].exits.north;
                output = rooms[currentRoom].description;
            } else {
                output = "You can't go that way.";
            }
            break;

        case 'go south':
            if(rooms[currentRoom].exits.south) {
                currentRoom = rooms[currentRoom].exits.south;
                output = rooms[currentRoom].description;
            } else {
                output = "You can't go that way.";
            }
            break;

        case 'go east':
            if(rooms[currentRoom].exits.east) {
                currentRoom = rooms[currentRoom].exits.east;
                output = rooms[currentRoom].description;
            } else {
                output = "You can't go that way.";
            }
            break;

        case 'go west':
            if(rooms[currentRoom].exits.west) {
                currentRoom = rooms[currentRoom].exits.west;
                output = rooms[currentRoom].description;
            } else {
                output = "You can't go that way.";
            }
            break;

        default:
            output = 'Unknown command: ' + command;
    }

    outputEl.innerHTML += `&amp;lt;div class="prompt"&amp;gt;$&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div&amp;gt;${command}&amp;lt;/div&amp;gt;&amp;lt;div&amp;gt;${output}&amp;lt;/div&amp;gt;`;
}

// Initial description
outputEl.innerHTML += `&amp;lt;div class="prompt"&amp;gt;$&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div&amp;gt;Welcome to Mini Zork!&amp;lt;/div&amp;gt;&amp;lt;div&amp;gt;${rooms[currentRoom].description}&amp;lt;/div&amp;gt;`;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Styling the Game with CSS:
The game has a retro terminal look, achieved by simple CSS:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;body, html {
    height: 100%;
    margin: 0;
    font-family: 'Courier New', monospace;
    background-color: #000;
    color: #00FF00;
}

#terminal {
    padding: 20px;
    height: 100%;
    box-sizing: border-box;
    overflow-y: auto;
}

#input-line {
    display: flex;
    align-items: center;
}

.prompt {
    margin-right: 5px;
}

#input {
    width: 100%;
    border: none;
    background: none;
    outline: none;
    color: inherit;
}
.field {
    white-space: pre;
    font-size: 20px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Play the Game:
Once everything is set up, launch the HTML page in your browser and start your adventure! Try commands like 'look', 'go north', 'go south', etc. Navigate through the rooms and find the treasure.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Conclusion&lt;/p&gt;

&lt;p&gt;Building a simple text-based game like "Mini Zork" is not only a fun project but also a great way to sharpen your web development skills. Feel free to extend the game by adding more rooms, challenges, or even NPCs. Enjoy coding and gaming!&lt;/p&gt;

&lt;p&gt;Also i'm going to give you some ways of extending it.&lt;/p&gt;

&lt;p&gt;More Rooms and Complex Maps:&lt;/p&gt;

&lt;p&gt;Multi-layered Rooms: Introduce rooms that have multiple layers, such as basements or upstairs.&lt;/p&gt;

&lt;p&gt;Interconnected World: Instead of a linear path, create loops where rooms can interconnect in multiple ways, making navigation a challenge.&lt;/p&gt;

&lt;p&gt;Introduce Items and Inventory:&lt;br&gt;
Players can pick up or drop items, which might be crucial for solving certain puzzles or unlocking specific rooms. For example, finding a key in one room to unlock another room.&lt;/p&gt;

&lt;p&gt;Add NPCs (Non-Player Characters):&lt;br&gt;
Introduce characters that provide hints, challenges, or trade items.&lt;br&gt;
Use an array or object to store their dialogues based on the player's progression.&lt;/p&gt;

&lt;p&gt;Advanced Commands:&lt;br&gt;
Let players use more complex commands like use  or talk to .&lt;br&gt;
Perhaps introduce a basic combat system where players can attack or defend.&lt;/p&gt;

&lt;p&gt;Puzzles and Riddles:&lt;br&gt;
Require players to solve puzzles to advance. This could be in the form of riddles, number puzzles, or logic puzzles.&lt;/p&gt;

&lt;p&gt;Save and Load System:&lt;br&gt;
Implement a local storage-based save system, so players don't have to start over every time they refresh the page.&lt;/p&gt;

&lt;p&gt;Styling and Themes:&lt;br&gt;
Introduce different themes. Perhaps a retro neon theme for a sci-fi story or a sepia-toned theme for a wild west adventure.&lt;br&gt;
Add sound effects or background music for immersion.&lt;/p&gt;

&lt;p&gt;Random Events:&lt;br&gt;
Introduce random events or encounters that provide an element of unpredictability to the game. Maybe there's a chance to find a rare item or encounter a mysterious character.&lt;/p&gt;

&lt;p&gt;Have fun and extending these will improve your understanding.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>codenewbie</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Creating a Simple Book API with Express.js</title>
      <dc:creator>Shawn2208</dc:creator>
      <pubDate>Fri, 18 Aug 2023 18:05:42 +0000</pubDate>
      <link>https://forem.com/shawn2208/creating-a-simple-book-api-with-expressjs-29o3</link>
      <guid>https://forem.com/shawn2208/creating-a-simple-book-api-with-expressjs-29o3</guid>
      <description>&lt;p&gt;Hello! In this article, we'll be creating a simple book API using Express.js. This API can be the foundation for building more complex projects such as a book review site, a library catalog, or even a bookstore.&lt;/p&gt;

&lt;p&gt;Prerequisites:&lt;br&gt;
Basic knowledge of JavaScript.&lt;br&gt;
Node.js installed on your pc.&lt;/p&gt;

&lt;p&gt;Setting Up:&lt;br&gt;
Start by creating a new directory for your project and initializing a Node.js application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir book-api &amp;amp;&amp;amp; cd book-api
npm init -y

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, let's install the required packages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install express

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Code:&lt;br&gt;
Create an index.js file. This will house our server and routes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const express = require('express');
const app = express();

app.use(express.json());

let books = [];

app.get('/books', (req, res) =&amp;gt; {
    res.json(books);
});

app.post('/books', (req, res) =&amp;gt; {
    const { title, author } = req.body;
    const newBook = { id: Date.now(), title, author };
    books.push(newBook);
    res.status(201).json(newBook);
});

app.put('/books/:id', (req, res) =&amp;gt; {
    const bookId = Number(req.params.id);
    const { title, author } = req.body;

    const bookIndex = books.findIndex(book =&amp;gt; book.id === bookId);
    if (bookIndex === -1) return res.status(404).json({ message: "Book not found" });

    books[bookIndex] = { id: bookId, title, author };
    res.json(books[bookIndex]);
});

app.delete('/books/:id', (req, res) =&amp;gt; {
    const bookId = Number(req.params.id);
    books = books.filter(book =&amp;gt; book.id !== bookId);
    res.status(204).end();
});

app.listen(3000, () =&amp;gt; {
    console.log('Server running on http://localhost:3000');
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Testing the API:&lt;br&gt;
You can test this API using tools like Postman or by integrating it into a frontend application.&lt;/p&gt;

&lt;p&gt;Conclusion:&lt;br&gt;
Building a basic API with Express.js is straightforward. This simple book API is just the beginning. You can expand it by adding more features, integrating a database, and implementing authentication and authorization.&lt;/p&gt;

&lt;p&gt;I hope you found this basic introduction to building an Express.js API helpful! If you enjoyed this guide and would like to delve deeper, give this article some ❤️ (likes). If we get enough interest, I'll create a follow-up post where we'll integrate a database and add authentication to our book API. This way, we can further enhance its features and make it more robust.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>JavaScript dumbed down Part three. control flow, basic functions, and interactions.</title>
      <dc:creator>Shawn2208</dc:creator>
      <pubDate>Thu, 17 Aug 2023 10:42:39 +0000</pubDate>
      <link>https://forem.com/shawn2208/javascript-dumbed-down-part-three-control-flow-basic-functions-and-interactions-3lmb</link>
      <guid>https://forem.com/shawn2208/javascript-dumbed-down-part-three-control-flow-basic-functions-and-interactions-3lmb</guid>
      <description>&lt;p&gt;Introduction:&lt;br&gt;
Understanding the fundamentals of Javascript is the key to building dynamic and interactive web applications, we'll dive into to the core concepts of control flow, functions and interactions with the (DOM) Document Object Model to empower you on your coding journey.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Control Flow and Conditional Statements:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Control flow determines the sequence in which code executes. Conditional statements allow your code to make decisions based on conditions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let age = 18;

if (age &amp;gt;= 18) {
    console.log("You're an adult.");
} else {
    console.log("You're a minor.");
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this analogy, the if statement is like a decision point where you decide whether someone is an adult or a minor based on their age. If the condition is met (age is greater than or equal to 18), you let them pass as an adult. Otherwise, they take the "minor" route.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Nested if Statements and Complex Decisions:
Complex decisions are managed through nested if statements.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let temperature = 25;

if (temperature &amp;gt; 30) {
    console.log("It's hot outside!");
} else if (temperature &amp;gt;= 20) {
    console.log("The weather is pleasant.");
} else {
    console.log("It's a bit chilly.");
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Messages are printed based on the temperature range.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Switch Statement for Multiple Values:
Switch statements simplify handling multiple variable values.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let day = "Wednesday";
let message = "";

switch (day) {
    case "Monday":
        message = "Back to work!";
        break;
    case "Friday":
        message = "Weekend is near!";
        break;
    default:
        message = "Just another day.";
}

console.log(message);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this scenario, the switch statement acts as a menu of days. If the day matches "Monday," you order the "Back to work!" option. If it's "Friday," you choose "Weekend is near!" Otherwise, you just go with "Just another day."&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Functions for Structured Code:
Functions encapsulate code for reuse.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function greet(name) {
    console.log("Hello, " + name + "!");
}

greet("Alice"); // Outputs: Hello, Alice!
greet("Bob");   // Outputs: Hello, Bob!

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Functions are like mini-scripts that you can call upon whenever you need them. They package a set of instructions together, allowing you to reuse the same logic without writing it out every time.&lt;br&gt;
Consider the greet function as a personalized greeting generator. You provide a name as an input (parameter), and the function outputs a tailored greeting.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Interacting with the DOM:
The DOM represents the structure of a webpage, and JavaScript allows you to interact with it.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;DOM Interaction&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;button id="myButton"&amp;gt;Click Me&amp;lt;/button&amp;gt;
    &amp;lt;script&amp;gt;
        const button = document.getElementById("myButton");
        button.addEventListener("click", function() {
            alert("Button clicked!");
        });
    &amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Conclusion:&lt;br&gt;
By mastering control flow, functions, and DOM interactions, you're equipped to create responsive and engaging web applications. JavaScript's power lies in its ability to make decisions, structure code, and interact with the DOM. Now, start experimenting and combining these concepts to build your own interactive web experiences!&lt;/p&gt;

&lt;p&gt;Next I will be diving further into JavaScript a whole article about Arrays &amp;amp; Loops, Array methods and examples of how you would use an array &amp;amp; loops in a real life scenario. &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Simple Text-Based Adventure Game in Node.js</title>
      <dc:creator>Shawn2208</dc:creator>
      <pubDate>Sat, 12 Aug 2023 11:12:05 +0000</pubDate>
      <link>https://forem.com/shawn2208/simple-text-based-adventure-game-in-nodejs-490j</link>
      <guid>https://forem.com/shawn2208/simple-text-based-adventure-game-in-nodejs-490j</guid>
      <description>&lt;p&gt;In this tutorial, we'll walk through creating a simple text-based adventure game in Node.js using the inquirer library for user prompts.&lt;/p&gt;

&lt;p&gt;Prerequisites&lt;br&gt;
Basic knowledge of JavaScript and Node.js.&lt;br&gt;
Node.js installed on your computer.&lt;/p&gt;

&lt;p&gt;Setting Up&lt;br&gt;
First, create a new directory called simple-game:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir simple-game
cd simple-game

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Initialize a new npm project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm init -y

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install the inquirer library:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i inquirer

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To allow the use of ES6 import/export syntax, open package.json and add the following line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"type": "module",

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a new file named game.js.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Import the 'inquirer' library to handle user input
import inquirer from 'inquirer';

// Define an array of different game scenarios
const scenarios = [
    // Scenario 1: Introduction
    {
        name: 'intro',
        message: 'You wake up in a mysterious room. What do you do?',
        choices: [
            { name: 'Look around', nextScenario: 'lookAround' },
            { name: 'Open the door', nextScenario: 'openDoor' }
        ]
    },
    // Scenario 2: Looking around
    {
        name: 'lookAround',
        message: 'You find an old key on a table and a window that is slightly ajar. What do you do?',
        choices: [
            { name: 'Take the key', nextScenario: 'takeKey' },
            { name: 'Open the window', nextScenario: 'openWindow' }
        ]
    },
    // Scenario 3: Opening the door
    {
        name: 'openDoor',
        message: 'The door creaks open, revealing a dark hallway.',
        choices: [
            { name: 'Enter the hallway', nextScenario: 'darkHallway' },
            { name: 'Stay in the room', nextScenario: 'stayInRoom' }
        ]
    },
    // ... (more scenarios)
    // Scenario 7: Conclusion
    {
        name: 'ending',
        message: 'Congratulations! You have completed the adventure.',
        choices: []
    }
];

// Function to present a scenario and get player choice
const presentScenario = async (scenario) =&amp;gt; {
    const answers = await inquirer.prompt([
        {
            type: 'list',
            name: 'choice',
            message: scenario.message,
            choices: scenario.choices.map(choice =&amp;gt; choice.name),
        }
    ]);

    return answers.choice;
};

// Function to start the game
const startGame = async () =&amp;gt; {
    // Start with the 'intro' scenario
    let currentScenario = scenarios.find(scenario =&amp;gt; scenario.name === 'intro');

    // Continue looping through scenarios as long as there's a current scenario
    while (currentScenario) {
        // Present the current scenario to the player and get their choice
        const playerChoice = await presentScenario(currentScenario);

        // Find the next scenario based on the player's choice and update the current scenario
        currentScenario = scenarios.find(scenario =&amp;gt; scenario.name === currentScenario.choices.find(choice =&amp;gt; choice.name === playerChoice).nextScenario);
    }

    // Print a thank-you message when the game ends
    console.log('Thanks for playing! Goodbye.');
};

// Start the game by calling the startGame function
startGame();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code defines various game scenarios and presents them to the player in sequence.&lt;br&gt;
Each scenario provides the player with multiple choices. When a choice is made, the game moves to the next scenario.&lt;/p&gt;

&lt;p&gt;Playing the Game&lt;br&gt;
To play the game, run the following command in your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node game.js

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Conclusion&lt;br&gt;
With just a few lines of code, you've created a simple, engaging text-based adventure game in Node.js! This is just the foundation – you can expand on this by adding more scenarios, integrating more libraries, or even creating a graphical interface.&lt;/p&gt;

&lt;p&gt;There you go! A simple tutorial on how to create a text-based adventure game in Node.js. You can further extend this by adding images, sounds, or even making it have a health system and more complex with additional logic and scenarios.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>node</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Node.js Tutorial: How to Send Emails with Nodemailer</title>
      <dc:creator>Shawn2208</dc:creator>
      <pubDate>Fri, 04 Aug 2023 13:18:37 +0000</pubDate>
      <link>https://forem.com/shawn2208/nodejs-tutorial-how-to-send-emails-with-nodemailer-56ih</link>
      <guid>https://forem.com/shawn2208/nodejs-tutorial-how-to-send-emails-with-nodemailer-56ih</guid>
      <description>&lt;p&gt;Creating a Node.js Contact Form with Nodemailer and Hotmail&lt;br&gt;
Introduction&lt;br&gt;
In this tutorial, we will create a simple contact form using Node.js and Nodemailer &lt;a href="https://nodemailer.com/about/"&gt;https://nodemailer.com/about/&lt;/a&gt;, with Hotmail as our email service. The goal is to allow users to fill out a form on your website, and receive an email notification with the contents of the form. This is a great feature for any website, as it provides an easy way for users to get in touch with you directly from the site.&lt;/p&gt;

&lt;p&gt;Step 1: Setting Up the Environment&lt;br&gt;
First, we need to install Node.js and npm (which is installed automatically with Node.js). You can download Node.js here &lt;a href="https://nodejs.org/en/docs/guides"&gt;https://nodejs.org/en/docs/guides&lt;/a&gt; and follow the installation instructions provided.&lt;/p&gt;

&lt;p&gt;Step 2: Installing Required Packages&lt;br&gt;
After setting up Node.js, we need to initialize a new Node.js project. In the terminal, navigate to your project directory and run &lt;code&gt;npm init -y&lt;/code&gt; &lt;br&gt;
to create a new project. Now, we need to install the required packages:&lt;br&gt;
&lt;code&gt;npm install express nodemailer cors body-parser dotenv&lt;/code&gt;&lt;br&gt;
Here's what each package does:&lt;br&gt;
&lt;code&gt;express:&lt;/code&gt; Fast, unopinionated, minimalist web framework for Node.js.&lt;br&gt;
&lt;code&gt;nodemailer&lt;/code&gt;: A module for Node.js to send emails.&lt;br&gt;
&lt;code&gt;cors&lt;/code&gt;: A Node.js package for providing a Connect/Express middleware that can be used to enable CORS (Cross-origin resource sharing) with various options.&lt;br&gt;
&lt;code&gt;body-parser&lt;/code&gt;: Parse incoming request bodies in a middleware before your handlers, available under the req.body property.&lt;br&gt;
&lt;code&gt;dotenv&lt;/code&gt;: Zero-dependency module that loads environment variables from a .env file into process.env.&lt;br&gt;
Step 3: Setting Up the Express.js Server&lt;br&gt;
Express.js is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. &lt;/p&gt;

&lt;p&gt;Let's set up a basic Express server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const express = require('express');
const app = express();
const port = 3000;

app.listen(port, () =&amp;gt; {
  console.log(`Server started on port ${port}`);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 4: Implementing Nodemailer&lt;br&gt;
Next, we'll implement Nodemailer. This tool allows us to send emails from our Node.js server. Here's how to configure Nodemailer with Hotmail settings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const nodemailer = require('nodemailer');
let transporter = nodemailer.createTransport({
    service: 'hotmail',
    auth: {
      user: 'your-email@hotmail.com',
      pass: 'your-password'
    },
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 5: Creating the POST Route&lt;br&gt;
Now, let's create a POST route for '/send', which we will use to send emails. We use body-parser to parse the request body and obtain form data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
const bodyParser = require('body-parser');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));

app.post('/send', (req, res) =&amp;gt; {
  let mailOptions = {
    from: 'your-email@hotmail.com',
    to: 'your-email@hotmail.com',
    subject: 'Contact form submission',
    text: `Name: ${req.body.name}, Email: ${req.body.email}, Message: ${req.body.message}`,
  };

  transporter.sendMail(mailOptions, (err, data) =&amp;gt; {
    if (err) {
      res.send('error' + JSON.stringify(err));
    } else {
      res.send('success');
    }
  });
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 6: Implementing the Contact Form&lt;br&gt;
On your client-side, create an HTML form and use AJAX to send a POST request to your '/send' route:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form id="contact-form"&amp;gt;
  &amp;lt;input type="text" id="name" placeholder="Your name"&amp;gt;
  &amp;lt;input type="email" id="email" placeholder="Your email"&amp;gt;
  &amp;lt;textarea id="message" placeholder="Message"&amp;gt;&amp;lt;/textarea&amp;gt;
  &amp;lt;button type="submit"&amp;gt;Send&amp;lt;/button&amp;gt;
&amp;lt;/form&amp;gt;

&amp;lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script&amp;gt;
  $("#contact-form").on('submit', function(e) {
    e.preventDefault();
    var data = {
      name: $("#name").val(),
      email: $("#email").val(),
      message: $("#message").val()
    };
    $.ajax({
      url: 'http://localhost:3000/send',
      type: 'POST',
      data: data,
      success: function(data) {
        alert('Email sent!');
      },
      error: function() {
        alert('An error occurred.');
      }
    });
  });
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 7: Handling Environment Variables&lt;br&gt;
For security reasons, you should never store sensitive information, like your email and password, directly in your code. Instead, use environment variables. The dotenv package loads environment variables from a .env file into process.env. In your project root, create a .env file and include your email and password:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;EMAIL=your-email@hotmail.com
PASSWORD=your-password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In your Node.js file, require dotenv at the top and use process.env to access your environment variables:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;require('dotenv').config();

let transporter = nodemailer.createTransport({
    service: 'hotmail',
    auth: {
      user: process.env.EMAIL,
      pass: process.env.PASSWORD
    },
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Conclusion&lt;br&gt;
Congratulations! You've successfully created a contact form using Node.js and Nodemailer, with Hotmail as your email service. If you have any questions or comments, please don't hesitate to leave them below.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Progress Bar using HTML, CSS, JS</title>
      <dc:creator>Shawn2208</dc:creator>
      <pubDate>Mon, 26 Jun 2023 16:06:00 +0000</pubDate>
      <link>https://forem.com/shawn2208/progress-bar-using-html-css-js-258n</link>
      <guid>https://forem.com/shawn2208/progress-bar-using-html-css-js-258n</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

HTML
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;title&amp;gt;progress bar&amp;lt;/title&amp;gt;
&amp;lt;link rel="stylesheet" href="style.css"&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;div class="progress-wrapper"&amp;gt;
        &amp;lt;progress id="progress" value="50" max="100"&amp;gt;&amp;lt;/progress&amp;gt;
        &amp;lt;span class="progress-label"&amp;gt;Level &amp;lt;span id="level"&amp;gt;0&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;
      &amp;lt;/div&amp;gt;



   &amp;lt;script src="index.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

CSS
`body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    margin: 0;
  }

  .progress-container {
    display: flex;
  }

  .progress-wrapper {
    position: relative;
    height: 20px;
    width: 200px;
  }

  #progress {
    appearance: none;
    height: 100%;
    width: 100%;
    border: none;
    background-color: #f0f0f0;
  }

  .progress-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: white;
    pointer-events: none;
  }
  `
JS
`const progress = document.getElementById('progress');
const levelElement = document.getElementById('level');

let level = 0;
levelElement.textContent = level;

function updateProgressBar() {
  progress.value += 1;
  if (progress.value === 100) {
    level += 1;
    levelElement.textContent = level;
    progress.value = 0;
  }
}

setInterval(updateProgressBar, 100);
`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;``&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
