<?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: entrepreneur123</title>
    <description>The latest articles on DEV Community by entrepreneur123 (@entrepreneur123).</description>
    <link>https://dev.to/entrepreneur123</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%2F815050%2F99daacec-8517-40d8-8a34-4b4789e3d8bd.jpeg</url>
      <title>DEV Community: entrepreneur123</title>
      <link>https://dev.to/entrepreneur123</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/entrepreneur123"/>
    <language>en</language>
    <item>
      <title>Request and Response in nodejs</title>
      <dc:creator>entrepreneur123</dc:creator>
      <pubDate>Thu, 16 Jun 2022 14:57:04 +0000</pubDate>
      <link>https://dev.to/entrepreneur123/request-and-response-in-nodejs-317l</link>
      <guid>https://dev.to/entrepreneur123/request-and-response-in-nodejs-317l</guid>
      <description>&lt;p&gt;Hey !! this is Irusha and in this post you are gonna to learn about the request and response in nodejs and lets jump into code directly.&lt;/p&gt;

&lt;p&gt;you got to create a views folder in which you will be creating about.html, home.html and 404.html and outside the folder you got to create server.js. And we will run the following code .Its simple and easy !! you gottta....&lt;/p&gt;

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

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

const server = http.createServer((req, res) =&amp;gt; {
  console.log(req.url, req.method);

  res.setHeader("Content-Type", "text/html");
  let path = "./views/";
  switch (req.url) {
    case "/":
      path += "index.html";
      break;
    case "/about":
      path += "about.html";
      break;
    default:
      path += "404.html";
      break;
  }
  fs.readFile(path, (err, data) =&amp;gt; {
    if (err) {
      console.log(err);
      res.end();
    } else {
      //res.write(data);
      res.end(data);
    }
  });
});

server.listen(3000, "localhost", () =&amp;gt; {
  console.log("listening to the 3000 local host");
});

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

&lt;/div&gt;



&lt;p&gt;After that run above code as node server and hit enter then you will see output. And tried out going to localhost:3000 you will get result .&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Mapping concept for beginner</title>
      <dc:creator>entrepreneur123</dc:creator>
      <pubDate>Fri, 22 Apr 2022 04:31:12 +0000</pubDate>
      <link>https://dev.to/entrepreneur123/mapping-concept-for-beginner-188o</link>
      <guid>https://dev.to/entrepreneur123/mapping-concept-for-beginner-188o</guid>
      <description>&lt;p&gt;APP.tsx&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Card, datas } from "../src/components/Card";
import "../src/components/Card.css";
import "./App.css";
// import { stringify } from "querystring";
const App = () =&amp;gt; {
  /
  return (
    &amp;lt;div className="main"&amp;gt;

       {
        datas.slice(0,3).map((val: { title: string; desc: string; id: number; createdDate: string; }) =&amp;gt; {
        return (
          &amp;lt;Card
            title={val.title}
            desc={val.desc}
            id={val.id}
            createdDate={val.createdDate}
          /&amp;gt;

        );
      })}

    &amp;lt;/div&amp;gt;
  );
};

export default App;

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

&lt;/div&gt;



&lt;p&gt;components/card.tsx&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export interface ICard {
  title: string;
  desc: string;
  id: number;
  createdDate: string;
}


 export const datas : ICard[] = [
  {
    title: "ABC",
    id: 1,
    desc: "this is desc1",
    createdDate: "12/03/2020"
  },
  {
    title: "DEX",
    id: 2,
    desc: "this is desc1",
    createdDate: "17/03/2020"
  },
  {
    title: "IJK",
    id: 3,
    desc: "this is desc1",
    createdDate: "2/03/2020"
  },
  {
    title: "LMN",
    id: 4,
    desc: "this is desc1",
    createdDate: "12/04/2020"
  },
];


export const Card: React.FC&amp;lt;ICard&amp;gt; = ({ title, desc, id, createdDate }) =&amp;gt; {
  return (
    &amp;lt;&amp;gt;
      &amp;lt;div className="all"&amp;gt;
        &amp;lt;h3&amp;gt;{id}&amp;lt;/h3&amp;gt;
        &amp;lt;h1&amp;gt;{title}&amp;lt;/h1&amp;gt;
        &amp;lt;p className="desc"&amp;gt;{desc}&amp;lt;/p&amp;gt;
        &amp;lt;div&amp;gt;{createdDate}&amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/&amp;gt;
  );
};

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

&lt;/div&gt;



&lt;p&gt;Flagicon.tsx&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import ReactDOM from "react-dom";


interface IOption {
  label: string;
  value: string;
  flagImg: string;
  type?: any;
}

const isOption: IOption[] = [
  { label: "Nepal", value: "nepal", flagImg: "nepal" },
  { label: "Canada", value: "canada", flagImg: "canada" },
  { label: "South Korea", value: "south-korea", flagImg: "sk" },
  { label: "USA", value: "USA", flagImg: "usa" },
];



export const SelectOption = () =&amp;gt; {
  return (
    &amp;lt;div className="select-option"&amp;gt;
      &amp;lt;Select
        // isFormatOptionLabel={isFormatOptionLabel}
        options={isOption}
      /&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

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

&lt;/div&gt;



&lt;p&gt;textbox.tsx&lt;br&gt;
&lt;/p&gt;

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

interface IconProps {
  src: string;
  alt: string;
  style?: object;
  className?: string;
}

interface TextProps {
  type: string;
  placeholder?: string;
  value?: string;
  onChange?: () =&amp;gt; {};
  style?: object;
  className?: string;
}

interface TextInputProps {
  iconProps: IconProps;
  textProps: TextProps;
  selectProps: SelectProps;
  optionProps: OptionProps[];
  // iconcountryProps: IconcountryProps;
}

interface SelectProps {
  id: string;
  className: string;
}
interface OptionProps {
  value: string;
  label?: string;
  className?: string;
}

export const Textbox: React.FC&amp;lt;TextInputProps&amp;gt; = ({
  iconProps,
  selectProps,
  optionProps,
  textProps,
  // iconcountryProps,
}) =&amp;gt; {
  return (

    &amp;lt;div className="inputbox"&amp;gt;
      &amp;lt;img {...iconProps} /&amp;gt;
      &amp;lt;input {...textProps} /&amp;gt;
      &amp;lt;select {...selectProps}&amp;gt;
        {optionProps.map((val) =&amp;gt; {
          return (
            &amp;lt;option {...val.value} {...val.className}&amp;gt;
              {val.label}
            &amp;lt;/option&amp;gt;
          );
        })}
      &amp;lt;/select&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

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

&lt;/div&gt;



&lt;p&gt;card.css&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.desc {
  padding: 4rem;
  font-size: 24px;
}

.image {
  height: auto;
  width: auto;
}

.all {
  margin: 30px;
  border: 1px solid black;
  box-shadow: 3px 3px 5px 6px #ccc;
  padding: 30px;
  height: 400px;
  width: 400px;
}

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>TypeScript Basic</title>
      <dc:creator>entrepreneur123</dc:creator>
      <pubDate>Wed, 30 Mar 2022 11:38:29 +0000</pubDate>
      <link>https://dev.to/entrepreneur123/typescript-basic-34d4</link>
      <guid>https://dev.to/entrepreneur123/typescript-basic-34d4</guid>
      <description>&lt;p&gt;first of all, create a boiler plate for the typescript-react ,&lt;br&gt;
as&lt;/p&gt;

&lt;p&gt;yarn create react-app input --template typescript&lt;/p&gt;

&lt;p&gt;Inside Src folder , we create a component folder and inside a components folder , we create following files as &lt;/p&gt;

&lt;p&gt;Greet.tsx&lt;br&gt;
Heading.tsx&lt;br&gt;
Oscar.tsx&lt;br&gt;
Person.tsx&lt;br&gt;
PersonList.tsx&lt;br&gt;
Status.tsx&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Greet.tsx&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type GreetProps = {
  name: string;
  messageCount: number;
  isLoggedin: boolean;
};

export const Greet = (props: GreetProps) =&amp;gt; {
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;h2&amp;gt;
        {props.isLoggedin
          ? `  welcome ${props.name}! you have ${props.messageCount} unread message`
          : "welcome guess!!"}
      &amp;lt;/h2&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Heading.tsx&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type HeadingProps = {
  children: string;
};

export const Heading = (props: HeadingProps) =&amp;gt; {
  return &amp;lt;h2&amp;gt;{props.children}&amp;lt;/h2&amp;gt;;
};

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Oscar.tsx&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type OscarProps = {
  children: React.ReactNode;
};

export const Oscar = (props: OscarProps) =&amp;gt; {
  return &amp;lt;div&amp;gt;{props.children}&amp;lt;/div&amp;gt;;
};


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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Person.tsx&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type PersonProps = {
  name: {
    first: string;
    last: string;
  };
};

export const Person = (props: PersonProps) =&amp;gt; {
  return (
    &amp;lt;div&amp;gt;
      {props.name.first} {props.name.last}
    &amp;lt;/div&amp;gt;
  );
};


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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;PersonList.tsx&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type PersonListProps = {
  names: {
    first: string;
    last: string;
  }[];
};

export const PersonList = (props: PersonListProps) =&amp;gt; {
  return (
    &amp;lt;div&amp;gt;
      {props.names.map((name) =&amp;gt; {
        return (
          &amp;lt;h2 key={name.first}&amp;gt;
            {name.first} {name.last}
          &amp;lt;/h2&amp;gt;
        );
      })}
    &amp;lt;/div&amp;gt;
  );
};

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Status.tsx&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useEffect, useState } from "react";

type StatusProps = {
  status: string;
};

export const Status: React.FC&amp;lt;StatusProps&amp;gt; = (props) =&amp;gt; {
  const [message, setMessage] = useState("");

  //   ? (message = "data fetched successfully")
  //   : props.status === "Error"
  //   ? (message = "Error fetching Data...")
  //   : (message = "not valid input");

  useEffect(() =&amp;gt; {
    setMessage(props.status);
  }, [props.status]);
  //   if (props.status === "Loading") {
  //     message = "Loading...";
  //   } else if (props.status === "success") {
  //     message = "Data fetched successfully";
  //   } else if (props.status === "error") {
  //     message = "error occured";
  //   }
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;h2&amp;gt;Status - {message}&amp;lt;/h2&amp;gt;
      {/* loading
            success
            error */}
    &amp;lt;/div&amp;gt;
  );
};

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;App.tsx&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";

import "./App.css";
import { Greet } from "./components/Greet";
import { Person } from "./components/Person";
import { PersonList } from "./components/PersonList";
import { Status } from "./components/Status";
import { Heading } from "./components/Heading";
import { Oscar } from "./components/Oscar";

function App() {
  const personName = {
    first: "nothing",
    last: "nothing1",
  };

  const nameList = [
    {
      first: "nothing",
      last: "nothing1",
    },
    {
      first: "nothing",
      last: "nothing1",
    },
    {
      first: "nothing",
      last: "nothing1",
    },
    {
      first: "nothing",
      last: "nothing1",
    },
  ];

  return (
    &amp;lt;div className="App"&amp;gt;
      &amp;lt;Greet name="nothing" messageCount={30} isLoggedin={false} /&amp;gt;
      &amp;lt;Person name={personName} /&amp;gt;
      &amp;lt;PersonList names={nameList} /&amp;gt;
      &amp;lt;Status status="loading" /&amp;gt;
      &amp;lt;Heading&amp;gt;Placeholder text&amp;lt;/Heading&amp;gt;
      &amp;lt;Oscar&amp;gt;
        &amp;lt;Heading&amp;gt;here you go&amp;lt;/Heading&amp;gt;
      &amp;lt;/Oscar&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

export default App;

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

&lt;/div&gt;



</description>
    </item>
  </channel>
</rss>
