<?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: JosephSam</title>
    <description>The latest articles on DEV Community by JosephSam (@joseph_muvevi).</description>
    <link>https://dev.to/joseph_muvevi</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%2F418135%2F706cdc67-fe12-46ec-9856-675d855dece6.jpg</url>
      <title>DEV Community: JosephSam</title>
      <link>https://dev.to/joseph_muvevi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joseph_muvevi"/>
    <language>en</language>
    <item>
      <title>How do i use multer's upload.array(fieldname[, maxCount]) for a nested object inside a mongoose subdocument</title>
      <dc:creator>JosephSam</dc:creator>
      <pubDate>Mon, 08 Aug 2022 10:39:25 +0000</pubDate>
      <link>https://dev.to/joseph_muvevi/how-do-i-use-multers-uploadarrayfieldname-maxcount-for-a-nested-object-inside-a-mongoose-subdocument-2ab6</link>
      <guid>https://dev.to/joseph_muvevi/how-do-i-use-multers-uploadarrayfieldname-maxcount-for-a-nested-object-inside-a-mongoose-subdocument-2ab6</guid>
      <description>&lt;p&gt;How do i use multer's upload.array(fieldname[, maxCount]) for a nested object inside a mongoose subdocument&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;link&lt;/strong&gt;: &lt;a href="https://stackoverflow.com/questions/73276471/how-do-i-use-multers-upload-arrayfieldname-maxcount-for-a-nested-object-in"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>multer</category>
      <category>express</category>
      <category>mongoose</category>
      <category>javascript</category>
    </item>
    <item>
      <title>I need help I having problem passing data to a child component</title>
      <dc:creator>JosephSam</dc:creator>
      <pubDate>Tue, 19 Apr 2022 13:27:45 +0000</pubDate>
      <link>https://dev.to/joseph_muvevi/i-need-help-i-having-problem-passing-data-to-a-child-component-4o5a</link>
      <guid>https://dev.to/joseph_muvevi/i-need-help-i-having-problem-passing-data-to-a-child-component-4o5a</guid>
      <description>&lt;p&gt;I have three components&lt;br&gt;
Services (contains the data),&lt;br&gt;
SizeimgcontentfooterCard4,&lt;br&gt;
ServicesModal&lt;/p&gt;

&lt;p&gt;the data looks like &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const serviceItemInformation = [
  {
       title: "...",
       id:"...",
       paragraph: ["..."],
       image:{src: "...", alt:"..."},
       modal: {
          title: "...",
          id: "...",
          icon:"...",
          image:{src: "...", alt:"..."},
          list:[...],
          paragraph: ["..."],
     }
  },
  {...}
    ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The Services sends mapped out data to SizeimgcontentfooterCard4 as well as ServicesModal components&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;Container sx={containerWrapper} maxWidth="xl"&amp;gt;
        &amp;lt;Grid container spacing={2}&amp;gt;
            {
                serviceItemInformation.map(el =&amp;gt; (
                    &amp;lt;&amp;gt;
                        &amp;lt;Grid sx={gridStyle} key={el.id} item lg={4} sm={12} &amp;gt;
                           &amp;lt;SizeimgcontentfooterCard4
                                title={el.title}
                                image={el.image.src}
                                alt={el.image.alt}
                                paragraph={el.paragraph}
                                id={el.id}
                                modalData={el.modal}
                                handleModal={handleModal}
                                modal={modal}
                            /&amp;gt;
                            &amp;lt;ServicesModal open={modal} setOpen={setModal} modal={el.modal}/&amp;gt;
                        &amp;lt;/Grid&amp;gt;
                    &amp;lt;/&amp;gt;
                ))
            }
        &amp;lt;/Grid&amp;gt;
&amp;lt;/Container&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The SizeimgcontentfooterCard4 is a reusable card that displays content with a button that opens the modal component ServicesModal&lt;/p&gt;

&lt;p&gt;The Items I get in SizeimgcontentfooterCard4 matches correctly with what i was expecting. But on ServicesModal component I only get values of the last object in serviceItemInformation. &lt;/p&gt;

&lt;p&gt;The ServiceModal Component is &lt;/p&gt;

&lt;p&gt;`&lt;br&gt;&lt;br&gt;
const ServicesModal = ({open, setOpen, modal,}) =&amp;gt; {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    const StyledModalImageArea = styled(Grid)(({theme}) =&amp;gt; ({
        width: "100%",
        height: "100%",
        backgroundColor: "red",
        position: "relative",
        padding: 0,
        backgroundImage: `linear-gradient(to right, rgba(0, 0, 0, 0.555), rgba(0, 0, 0, 0.484)), url(${modal.image.src})`,
        backgroundPosition: "center",
        backgroundAttachment: "local",
        backgroundSize: "cover",
        backgroundRepeat: "no-repeat",
        transition: "0.5s", 
        color: "#fff",
        borderTopLeftRadius: 10,
        borderBottomLeftRadius: 10
    }))



    return (
        &amp;lt;StyledBackDrop
            open={open}
            onClick={() =&amp;gt; setOpen(false)}
            sx={{ color : "rgba(0, 0, 0, 0.56) !important",  zIndex: (theme) =&amp;gt; theme.zIndex.drawer + 1 }}
            transitionDuration= {1000}
        &amp;gt;
            &amp;lt;StyledModal
                hideBackdrop
                open={open}
                onClose={() =&amp;gt; setOpen(false)}
                aria-labelledby="modal-modal-title"
                aria-describedby="modal-modal-description"
            &amp;gt;
                    &amp;lt;StyledModalItems container sx={detailsContainer}&amp;gt;
                        &amp;lt;StyledModalImageArea item lg={5} sm={12}&amp;gt;
                            &amp;lt;BoxOverlay&amp;gt;
                                {modal.icon}
                            &amp;lt;/BoxOverlay&amp;gt;
                        &amp;lt;/StyledModalImageArea&amp;gt;

                        &amp;lt;Grid item lg={7} sm={12}&amp;gt;
                            &amp;lt;Typography id="modal-modal-title" variant="h4" gutterBottom component="h2"&amp;gt;
                                { modal.title }
                            &amp;lt;/Typography&amp;gt;
                        &amp;lt;/Grid&amp;gt;
                    &amp;lt;/StyledModalItems&amp;gt;
            &amp;lt;/StyledModal&amp;gt;
        &amp;lt;/StyledBackDrop&amp;gt;
    )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;`&lt;br&gt;
What could  the problem be?&lt;/p&gt;

&lt;p&gt;Link to &lt;a href="https://stackoverflow.com/questions/71922939/i-am-getting-mapping-error-when-sending-props-to-children"&gt;stackOverflow &lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>jsx</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How do I solve Configuration property "jwt" and "DB" is not defined error</title>
      <dc:creator>JosephSam</dc:creator>
      <pubDate>Thu, 07 Oct 2021 22:07:23 +0000</pubDate>
      <link>https://dev.to/joseph_muvevi/how-do-i-solve-configuration-property-jwt-and-db-is-not-defined-error-3e0o</link>
      <guid>https://dev.to/joseph_muvevi/how-do-i-solve-configuration-property-jwt-and-db-is-not-defined-error-3e0o</guid>
      <description>&lt;div class="ltag__stackexchange--container"&gt;
  &lt;div class="ltag__stackexchange--title-container"&gt;
    
      &lt;div class="ltag__stackexchange--title"&gt;
        &lt;h1&gt;
          &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7Gn-iPj_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/stackoverflow-logo-b42691ae545e4810b105ee957979a853a696085e67e43ee14c5699cf3e890fb4.svg" alt=""&gt;
            &lt;a href="https://stackoverflow.com/questions/69466298/how-do-i-solve-configuration-property-jwt-and-db-is-not-defined-error" rel="noopener noreferrer"&gt;
              How do I solve Configuration property "jwt" and "DB" is not defined error
            &lt;/a&gt;
        &lt;/h1&gt;
        &lt;div class="ltag__stackexchange--post-metadata"&gt;
          &lt;span&gt;Oct  6 '21&lt;/span&gt;
            &lt;span&gt;Comments: 1&lt;/span&gt;
            &lt;span&gt;Answers: 2&lt;/span&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;a class="ltag__stackexchange--score-container" href="https://stackoverflow.com/questions/69466298/how-do-i-solve-configuration-property-jwt-and-db-is-not-defined-error" rel="noopener noreferrer"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y9mJpuJP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/stackexchange-arrow-up-eff2e2849e67d156181d258e38802c0b57fa011f74164a7f97675ca3b6ab756b.svg" alt=""&gt;
        &lt;div class="ltag__stackexchange--score-number"&gt;
          0
        &lt;/div&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wif5Zq3z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/stackexchange-arrow-down-4349fac0dd932d284fab7e4dd9846f19a3710558efde0d2dfd05897f3eeb9aba.svg" alt=""&gt;
      &lt;/a&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--body"&gt;
    
&lt;p&gt;I am trying to push my web application (MERN stack) to Heroku but I keep getting this error&lt;/p&gt;
&lt;p&gt;&lt;a href="https://i.stack.imgur.com/39Yz1.png" rel="nofollow noreferrer"&gt;enter image description here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;What I have tried
in index.js&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;if (!config.get("jwtPrivateKey")) {
throw new Error('FATAL ERROR!!: jwtPrivateKey is not defined')
}
console.log(config.get("DB"))
console.log(config.get("jwtPrivateKey"))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is their value when i log them&lt;/p&gt;
&lt;p&gt;…&lt;/p&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--btn--container"&gt;
    
      &lt;a href="https://stackoverflow.com/questions/69466298/how-do-i-solve-configuration-property-jwt-and-db-is-not-defined-error" rel="noopener noreferrer"&gt;Open Full Question&lt;/a&gt;
    
  &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>heroku</category>
      <category>node</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>What is the best approach; hashing password in req.body.password or at the database user.password in express-mongoose web app</title>
      <dc:creator>JosephSam</dc:creator>
      <pubDate>Fri, 02 Apr 2021 17:44:05 +0000</pubDate>
      <link>https://dev.to/joseph_muvevi/what-is-the-best-approach-hashing-password-in-req-body-password-or-at-the-database-user-password-in-express-mongoose-web-app-3i55</link>
      <guid>https://dev.to/joseph_muvevi/what-is-the-best-approach-hashing-password-in-req-body-password-or-at-the-database-user-password-in-express-mongoose-web-app-3i55</guid>
      <description>&lt;p&gt;I am creating a user post route in which i'll be doing the password hashing. So what is the best approach for hashing password is it this;&lt;/p&gt;

&lt;p&gt;let user = await User.findOne({email: req.body.email})&lt;br&gt;
if (user) return res.status(400).send('The user already exists')&lt;/p&gt;

&lt;p&gt;user = new User({&lt;br&gt;
    name : req.body.name,&lt;br&gt;
    email: req.body.email,&lt;br&gt;
    password: req.body.password&lt;br&gt;
})&lt;/p&gt;

&lt;p&gt;// hashing user passwords&lt;br&gt;
const salting = await bcrypt.genSalt(10)&lt;br&gt;
user.password = await bcrypt.hash(user.password, salting)&lt;br&gt;
Hashing it on the database level or this;&lt;/p&gt;

&lt;p&gt;let user = await User.findOne({email: req.body.email})&lt;br&gt;
if (user) return res.status(400).send('The user already exists')&lt;/p&gt;

&lt;p&gt;// hashing user passwords&lt;br&gt;
    const salting = await bcrypt.genSalt(10)&lt;br&gt;
    const hashedPassword = await bcrypt.hash(req.body.password, salting)&lt;/p&gt;

&lt;p&gt;user = new User({&lt;br&gt;
    name : req.body.name,&lt;br&gt;
    email: req.body.email,&lt;br&gt;
    password: hashedPassword&lt;br&gt;
})&lt;br&gt;
hashing on the request level, or there is a better way of doing the hashing? Your opinions/recommendation will be much useful. Thanks in advance.&lt;/p&gt;

</description>
      <category>node</category>
      <category>express</category>
      <category>mongoose</category>
      <category>mongodb</category>
    </item>
    <item>
      <title>..map is not a function</title>
      <dc:creator>JosephSam</dc:creator>
      <pubDate>Sat, 27 Jun 2020 13:22:14 +0000</pubDate>
      <link>https://dev.to/joseph_muvevi/map-is-not-a-function-2hj0</link>
      <guid>https://dev.to/joseph_muvevi/map-is-not-a-function-2hj0</guid>
      <description>&lt;p&gt;Hi everyone am a newbie in react and have encountered this problem, need help &lt;br&gt;
&lt;a href="https://codesandbox.io/s/interesting-sara-q2j9w?file=/src/App.js"&gt;https://codesandbox.io/s/interesting-sara-q2j9w?file=/src/App.js&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>help</category>
    </item>
  </channel>
</rss>
