<?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>DEV Community: Piyush Kumar Das</title>
    <description>The latest articles on DEV Community by Piyush Kumar Das (@piyushkdas0611).</description>
    <link>https://dev.to/piyushkdas0611</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%2F956624%2F49a0dfb4-4949-4524-8d3b-5ae9a5a6c922.jpeg</url>
      <title>DEV Community: Piyush Kumar Das</title>
      <link>https://dev.to/piyushkdas0611</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/piyushkdas0611"/>
    <language>en</language>
    <item>
      <title>Random Bhagavad Gita Quotes API</title>
      <dc:creator>Piyush Kumar Das</dc:creator>
      <pubDate>Wed, 13 Dec 2023 12:18:51 +0000</pubDate>
      <link>https://dev.to/piyushkdas0611/random-bhagavad-gita-quotes-api-490e</link>
      <guid>https://dev.to/piyushkdas0611/random-bhagavad-gita-quotes-api-490e</guid>
      <description>&lt;p&gt;In this world of technology, where innovation knows no bounds, developers are finding inspiration in unexpected places. One such fascinating project has emerged from the intersection of ancient wisdom and modern coding – the Random Bhagavad Gita Quotes API. In this blog post, we'll delve into the creation of this unique API, built using NodeJS and ExpressJS, and hosted on Vercel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tech Stack
&lt;/h2&gt;

&lt;h3&gt;
  
  
  NodeJS and ExpressJS
&lt;/h3&gt;

&lt;p&gt;NodeJS, known for its speed and scalability, is the perfect choice for building server-side applications. ExpressJS, a minimalist web application framework for Node, developers can create robust APIs with ease.&lt;/p&gt;

&lt;h2&gt;
  
  
  Crafting the API
&lt;/h2&gt;

&lt;p&gt;Before we dive into coding, make sure you have Node.js installed on your system. If not, you can download it from &lt;a href="https://nodejs.org/en" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now, open your terminal and follow these steps:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Create a new project:
&lt;/h3&gt;

&lt;p&gt;Run the following command to initialize a new Node.js project and create a package.json file:&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;The -y flag auto-fills default values for your package.json file, making the setup quicker.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Install dependencies:
&lt;/h3&gt;

&lt;p&gt;Install express – the web application framework for Node.js – by running the following command:&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;h3&gt;
  
  
  3. Create the entry point:
&lt;/h3&gt;

&lt;p&gt;Create a new file, let's name it index.js, as the entry point for your application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// index.js

const express = require('express');
const app = express();
const port = 3000;

app.get('/', (req, res) =&amp;gt; {
  res.send('Welcome to the Bhagavad Gita API!');
});

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Run the server:
&lt;/h3&gt;

&lt;p&gt;Execute the following command in your terminal to start the server:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;If you see this 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;Server is running on port 3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And this in localhost:3000 in your browser:&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%2Fdv4ge4t8zgh7e2lj3qkx.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%2Fdv4ge4t8zgh7e2lj3qkx.png" alt="Example Output" width="800" height="381"&gt;&lt;/a&gt;&lt;br&gt;
Then very good, you have done a praiseworthy task till now.&lt;/p&gt;
&lt;h3&gt;
  
  
  5. Create a quote object:
&lt;/h3&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const bhagavadGitaVerses = [
  {
    id: 1,
    text: "Your thoughts are arrows, Arjuna. Aim them towards the divine, and pierce the veil of illusion.",
  },
  {
    id: 2,
    text: "Doubts are clouds obscuring the sun of your inner wisdom. Seek clarity through focused meditation.",
  },
  {
    id: 3,
    text: "Action without attachment is the dance of the soul, a graceful offering to the cosmic stage.",
  }
];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similarly add more quotes to it you can use ChatGPT for that.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Create an endpoint
&lt;/h3&gt;

&lt;p&gt;Before creating endpoint, I would like to tell you that, Endpoints act as gateways or entry points to access the functionalities provided by the API. Each endpoint represents a specific operation or resource that the API makes available.&lt;br&gt;
Add this to your index.js:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.get("/api/random-verse", (req, res) =&amp;gt; {
  const randomVerse = getRandomVerse();
  res.json(randomVerse);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But wait something is missing I guess. Correct! it's the getRandomVerse() function, so we will create that next.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Creating the function to generate Random Quotes:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function getRandomVerse() {
  const randomIndex = Math.floor(Math.random() * bhagavadGitaVerses.length);
  return bhagavadGitaVerses[randomIndex];
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add this function to your index.js file.&lt;br&gt;
Now your code might be looking something 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%2F46hk87zc9cnn95dc59r5.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%2F46hk87zc9cnn95dc59r5.png" alt="final code" width="800" height="994"&gt;&lt;/a&gt;&lt;br&gt;
Great Work!&lt;br&gt;
Now head back to your browser and go to: &lt;a href="http://localhost:3000/api/random-verse" rel="noopener noreferrer"&gt;http://localhost:3000/api/random-verse&lt;/a&gt;&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%2Flhk090w7zidxvenc1jvw.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%2Flhk090w7zidxvenc1jvw.png" alt="JSON output" width="800" height="271"&gt;&lt;/a&gt;&lt;br&gt;
If you get this JSON as output on your browser. &lt;br&gt;
Congratulations! You just created an API.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>express</category>
      <category>api</category>
    </item>
    <item>
      <title>HacktoberFest'23 Maintainer</title>
      <dc:creator>Piyush Kumar Das</dc:creator>
      <pubDate>Sun, 29 Oct 2023 14:53:32 +0000</pubDate>
      <link>https://dev.to/piyushkdas0611/hacktoberfest23-maintainer-1797</link>
      <guid>https://dev.to/piyushkdas0611/hacktoberfest23-maintainer-1797</guid>
      <description>&lt;h3&gt;
  
  
  Intro
&lt;/h3&gt;

&lt;p&gt;I'm Piyush Kumar Das, a Web Developer, Programmer, and Tech Writer. This was my debut as a Hacktoberfest maintainer, where I guided contributors and reviewed their open-source contributions. It's been a rewarding experience collaborating with the community. Check out my &lt;a href="https://github.com/piyushkdas0611" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Project
&lt;/h3&gt;

&lt;p&gt;I maintained the "&lt;a href="https://github.com/piyushkdas0611/Profile-Card-Generator" rel="noopener noreferrer"&gt;Profile Card Generator&lt;/a&gt;" repository, a user-friendly tool for crafting stylish profile cards, ideal for portfolios and websites. Built with HTML, CSS, and JavaScript, it empowers users to generate customized cards with ease. This project adds a creative touch to personal branding and enhances online presence.&lt;/p&gt;

&lt;h3&gt;
  
  
  Highs and Lows
&lt;/h3&gt;

&lt;p&gt;This month, my major accomplishment was my inaugural participation as a maintainer during Hacktoberfest. It was an insightful experience where I learned new skills, collaborated with contributors, and had fun while doing so. One notable challenge was dealing with merge conflicts, which initially seemed daunting. However, with the help of Chat GPT and online resources, I successfully resolved them, enhancing my GitHub proficiency. Overall, it was a rewarding and educational journey.&lt;/p&gt;

&lt;h3&gt;
  
  
  Growth
&lt;/h3&gt;

&lt;p&gt;Before Hacktoberfest 2023, I had a solid foundation in web development and a basic understanding of version control systems. Throughout the event, my knowledge of version control systems significantly improved, allowing for more efficient project management. While my project goals remained the same, the experience encouraged me to enhance it with additional features and improvements. It reinforced my commitment to maintaining and evolving the "Profile Card Generator" project while furthering my expertise in open source collaboration.&lt;/p&gt;

</description>
      <category>hack23maintainer</category>
      <category>hacktoberfest23</category>
    </item>
    <item>
      <title>HackToberFest'23 Contributor</title>
      <dc:creator>Piyush Kumar Das</dc:creator>
      <pubDate>Sat, 21 Oct 2023 08:15:25 +0000</pubDate>
      <link>https://dev.to/piyushkdas0611/hacktoberfest23-contributor-5cnh</link>
      <guid>https://dev.to/piyushkdas0611/hacktoberfest23-contributor-5cnh</guid>
      <description>&lt;h3&gt;
  
  
  Intro
&lt;/h3&gt;

&lt;p&gt;I am Piyush Kumar Das, I am a developer, programmer and tech writer. Excited to be part of HacktoberFest for the second time, where I channel my enthusiasm for open source collaboration and innovation. It's a platform that encourages me to contribute, learn, and grow in the tech community.&lt;br&gt;
&lt;a href="https://github.com/piyushkdas0611" rel="noopener noreferrer"&gt;Visit My GitHub&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  My 4PRs
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/Devansh-Singh-Parmar/AdBlocker/pull/14" rel="noopener noreferrer"&gt;PR1&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/akanshSirohi/Github-Cards-API/pull/41" rel="noopener noreferrer"&gt;PR2&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/Kritika30032002/To-Do-List-Application/pull/105" rel="noopener noreferrer"&gt;PR3&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/KwickerHub/frontend/pull/487" rel="noopener noreferrer"&gt;PR4&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Highs and Lows
&lt;/h3&gt;

&lt;p&gt;One of my most significant accomplishments this month was having a light-bulb moment while creating a low-code app using Illa Cloud. It marked my first foray into low-code development, introducing me to a world of novel concepts. Although it seemed daunting initially, I overcame challenges by watching YouTube tutorials, diving into documentation, and studying other projects. This experience not only broadened my skill set but also instilled a sense of adaptability in problem-solving.&lt;/p&gt;

&lt;p&gt;Another notable accomplishment this month was my experience with a pull request that didn't get selected, but it provided a valuable learning opportunity. I delved into unit testing using Jest, a previously unfamiliar component of my tech stack. Though the PR outcome was not as expected, the knowledge gained about testing methodologies was a valuable takeaway, showcasing my willingness to explore and adapt to new technologies.&lt;/p&gt;

&lt;h3&gt;
  
  
  Growth
&lt;/h3&gt;

&lt;p&gt;Before HacktoberFest 2023, my skillset primarily revolved around basic JavaScript programming. However, through this event, I ventured into diverse projects, including contributing to a browser extension, crafting APIs, contributing to a todo-list, designing website templates, and building a low-code app with Illa Cloud. These experiences substantially improved my coding versatility and problem-solving abilities. My learning and career goals have evolved, now encompassing a broader spectrum of software development and innovation.&lt;/p&gt;

</description>
      <category>hack23contributor</category>
      <category>hacktoberfest23</category>
    </item>
    <item>
      <title>Starting with GitHub Actions</title>
      <dc:creator>Piyush Kumar Das</dc:creator>
      <pubDate>Fri, 19 May 2023 15:36:53 +0000</pubDate>
      <link>https://dev.to/piyushkdas0611/starting-with-github-actions-23c8</link>
      <guid>https://dev.to/piyushkdas0611/starting-with-github-actions-23c8</guid>
      <description>&lt;h2&gt;
  
  
  GitHub User Finder using GitHub API and set GitHub Actions on the repo
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Category Submission
&lt;/h3&gt;

&lt;p&gt;Walky Wildcard&lt;/p&gt;

&lt;h3&gt;
  
  
  App Link
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://piyushkdas0611.github.io/github-user-search-app/" rel="noopener noreferrer"&gt;LINK&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Screenshots
&lt;/h3&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%2Fybeznwkh0qttnc2cbxpg.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%2Fybeznwkh0qttnc2cbxpg.png" alt="Image light-mode screenshot" width="800" height="450"&gt;&lt;/a&gt;&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%2Fpuxq5ua60mlr8i6ihb6t.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%2Fpuxq5ua60mlr8i6ihb6t.png" alt="Image dark-mode screenshot" width="800" height="450"&gt;&lt;/a&gt;&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%2Fb22t76bspt0kqpd3x904.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%2Fb22t76bspt0kqpd3x904.jpeg" alt="Image github action" width="540" height="1170"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Description
&lt;/h3&gt;

&lt;p&gt;This is an application that let anyone find any GitHub user by their username. It displays details of the GitHub user such as Name, Joining date, Followers, Repos, Following, Location, Websites, Bio, etc.&lt;/p&gt;

&lt;h3&gt;
  
  
  Link to Source Code
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/piyushkdas0611/github-user-search-app" rel="noopener noreferrer"&gt;Source Code&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Permissive License : MIT
&lt;/h3&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;Well, the idea was to decrease the time of user searching in GitHub and getting the details of any user without opening GitHub.&lt;br&gt;
The most important part was I wanted to try GitHub Actions for the first time. The idea of getting notification if any push or pull request is made to the repo with the commit message, drive me in making this.&lt;/p&gt;

&lt;h3&gt;
  
  
  How I built it
&lt;/h3&gt;

&lt;p&gt;I used HTML to structure the website, CSS to style the website, and JavaScript to code the Website, and YML to create the GitHub action. By building this I get the exposure of CI/CD and how to make the deployment process, and collaboration more interactable.&lt;/p&gt;

&lt;h3&gt;
  
  
  Additional Resources/Info
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;ChatGPT&lt;/li&gt;
&lt;li&gt;Telegram&lt;/li&gt;
&lt;li&gt;StackOverflow&lt;/li&gt;
&lt;li&gt;Grammarly&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>githubhack23</category>
      <category>githubactions</category>
      <category>javascript</category>
      <category>yml</category>
    </item>
    <item>
      <title>Web Scrapper using NodeJS, Express, Cheerio and Axios</title>
      <dc:creator>Piyush Kumar Das</dc:creator>
      <pubDate>Sun, 14 May 2023 21:51:35 +0000</pubDate>
      <link>https://dev.to/piyushkdas0611/web-scrapper-using-nodejs-express-cheerio-and-axios-32n2</link>
      <guid>https://dev.to/piyushkdas0611/web-scrapper-using-nodejs-express-cheerio-and-axios-32n2</guid>
      <description>&lt;h2&gt;
  
  
  Web Scrapper
&lt;/h2&gt;

&lt;p&gt;A web scraper is a software tool or program that automates the process of collecting data from websites. It uses automated scripts or bots to extract data from web pages by reading and analyzing the HTML code of the page. Web scrapers can be used to extract a wide range of data, such as product prices, reviews, social media posts, and more.&lt;/p&gt;

&lt;p&gt;Web scraping has become increasingly popular in recent years as a means of gathering data for research, market analysis, and business intelligence. However, it is important to note that some websites explicitly prohibit web scraping in their terms of service, and scraping certain types of data may be illegal in some jurisdictions. As such, it is important to ensure that you are not violating any laws or policies before using a web scraper.&lt;/p&gt;

&lt;p&gt;Here we will create a very basic version of a web scrapper which will allow us to scrap HTML data from websites.&lt;/p&gt;

&lt;h2&gt;
  
  
  Steps
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Make sure you have node installed with the latest version.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;node --version&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Start by creating a directory and run &lt;code&gt;npm init&lt;/code&gt; , this &lt;br&gt;
will create a package.json file which will help in&lt;br&gt;&lt;br&gt;
dependency management and script management, create an&lt;br&gt;&lt;br&gt;
index.js file next.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install four packages using npm:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;npm i express&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;npm i cheerio&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;npm i axios&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;npm i nodemon&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now in your package.json, change the "start" in the "scripts" to &lt;code&gt;nodemon index.js&lt;/code&gt;. Your package.json will start looking something like this.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&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%2F33qg3sbt388n7n55nhtc.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%2F33qg3sbt388n7n55nhtc.png" alt="Image json-file" width="800" height="929"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now in your index.js, load the modules using:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create a listening port like this:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const PORT = 8000
const app = express()
app.listen(PORT , ()=&amp;gt; console.log(`Server running on port ${PORT}`))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Now take the url of the website which you want to scrape and store the url in any variable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then using axios create a promise and url as its parameters.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;axios(url)
    .then(response =&amp;gt; {
        const html = response.data
        const $ = cheerio.load(html)
        const articles = []
        $('li', html).each(function() {
            const title = $(this).text()
            const url = $(this).find('a').attr('href') 
            articles.push({
                title,
                url
            })
        })
        console.log(articles)
    }).catch(err =&amp;gt; console.log('Error occured'))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Here articles is an array which will store the scrapped data. In the above code I have scrapped a website to get data of all the &lt;/p&gt;&lt;/li&gt;
&lt;li&gt; tag and if they have any &lt;a&gt; tag then the links.&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finally add all the data to the articles array.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The final code would start appearing like this :&lt;/p&gt;&lt;/li&gt;
&lt;/ul&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%2Foym420pq2ckuk6umosij.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%2Foym420pq2ckuk6umosij.png" alt="Image finale-code" width="800" height="810"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now in the terminal run &lt;code&gt;npm start&lt;/code&gt; to see the results.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Output of above code:&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%2Fl787ei91rln20o0tfulp.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%2Fl787ei91rln20o0tfulp.png" alt="Image output" width="800" height="708"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>express</category>
      <category>npm</category>
    </item>
    <item>
      <title>Create a Number Guessing Game using Node JS</title>
      <dc:creator>Piyush Kumar Das</dc:creator>
      <pubDate>Mon, 08 May 2023 10:19:09 +0000</pubDate>
      <link>https://dev.to/piyushkdas0611/create-a-number-guessing-game-using-node-js-50a</link>
      <guid>https://dev.to/piyushkdas0611/create-a-number-guessing-game-using-node-js-50a</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A number guessing game is a game such that in which a random number is generated, but you don't know the number.&lt;br&gt;
Then you have to make successive guesses to find out the number. Each time you guess the number, the generator tells you how close you are to the number by telling to guess higher or lesser.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Resources required&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;VS code or any IDE&lt;/li&gt;
&lt;li&gt;Node JS&lt;/li&gt;
&lt;li&gt;The basic knowledge of callback functions and event emitter&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Tutorial&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Start by creating a JS file in VS code.&lt;/li&gt;
&lt;li&gt;Then import the readline module of Node JS.&lt;/li&gt;
&lt;/ul&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%2Fdn6tpjv1g4l48qktveze.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%2Fdn6tpjv1g4l48qktveze.png" alt="Image code" width="800" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create an instance of Interface class of readline module&lt;/li&gt;
&lt;/ul&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%2Fhi9i2810oj131a1xvdw3.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%2Fhi9i2810oj131a1xvdw3.png" alt="Image code" width="800" height="444"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now generate a random number using Math.floor and Math.random&lt;/li&gt;
&lt;/ul&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%2Fa5nm713x1s06iraz7j1q.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%2Fa5nm713x1s06iraz7j1q.png" alt="Image code" width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now apply this logic to take input, check and if required then prompt for another input&lt;/li&gt;
&lt;/ul&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%2Fl0qrwdx6846jhpx0pqn8.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%2Fl0qrwdx6846jhpx0pqn8.png" alt="Image code" width="800" height="1136"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;-Finally, use the event emitter module to listen the close event and execute a callback function.&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%2Fut1g2qsui45xflqmq2bg.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%2Fut1g2qsui45xflqmq2bg.png" alt="Image code" width="800" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>node</category>
    </item>
  </channel>
</rss>
