title: Getting Images from node JS ( or database ) to React JS
body: <p>I managed to upload a file in React JS and store it in my NodeJS public folder, i am also storing them in a database(just the file names) <br><br>
  What I'm trying to do is now that my files are uploaded, how can i GET the files from the server ( or database or both ). <br><br>
  My upload function in the front-end looks like this:</p>
  
  <pre><code>    onSubmit = (event) =&gt; {
        //some security here so i make sure that the upload is an valid image 
        //I am uploading Ads for my page
        const data=new FormData();
        data.append('adimage',adimage);
        data.append('adurl',adurl);
  
        fetch('http://localhost:3001/uploadad',{
            method:'POST',
            body:data,
        }).then((response)=&gt;{
            response.json().then(ad=&gt;{
                let ads=this.state.ads;
                ads=[...ads,ad.file];
                this.setState({ads:ads});
            }) 
                .catch(err=&gt;console.log('failed to upload image'));
        }).catch(err=&gt;console.log('error uploading image'));
  </code></pre>
  
  <p>And the NodeJS back-end:</p>
  
  <pre><code>const uploadAd= (req,res,db,urlExists)=&gt;{
  //some security here so i make sure that the upload is an valid image
  db('ads')
      .insert({
          image: ad.name,
          url: adurl
      })
      .returning('id')
      .then(id =&gt; {
          db('ads').update({
              image: `ad${id[0]}.${ext}`
          })
           //just want to store all ad images as ad{adid}
              .where('id', '=', id[0])
              .returning(['image', 'url'])
              .then(data =&gt; {
                  let img = data[0].image;
                  let url = data[0].url;
  
                  const reqPath = path.join(__dirname, '..\\..\\');
                  //uploading the file to the public folder
                  ad.mv(`${reqPath}/public/${img}`, (err) =&gt;{
                      if (err) {
                          return res.status(500).send(err);
                      }
                      res.json({
                          file: `${img}`,
                          url: url
                      });
                  });
              }).catch(err =&gt; console.log(err));
      }).catch(err =&gt; console.log(err));
  };
  </code></pre>
  
  <p>Now that my files are stored in a folder in the server side how can i fetch the data in the client side?<br><br> Can i just store them in my database without the need to upload the files, but from what i know that is not a good practice ? 
  I am pretty new to react and node and this is my first post here. Thank you</p>