title: How to view images/photo stored as a blob in mysql using node.js?
body: <p>I have saved images as blobs directly to a mysql database with other data column fields. Using Node.js, I can view all the data using  an ajax request, however I am not able to view the images as value.Image.
  ('')</p>
  
  <p>They all appear to be broken. Even though I am using base64 encode.</p>
  
  <pre><code>              //(1)getting all data from database in the backend]
  
                app.get("/alldata", (req, res) =&gt; {
            db.query("SELECT * FROM stores", (err, rows, fields) =&gt; {
          if (!err) res.send(rows);
          else console.log(err);
           });
              });
  
  </code></pre>
  
  <pre><code>           //(1) - Datalist
             $(document).ready(() =&gt; {
  
             $('#allData').click(() =&gt; {
              if ($('#stores').is(':empty')) {
              console.log('It is empty, data can load');
             $.ajax({
              url: 'http://localhost:5000/alldata',
              type: 'GET',
              datatype: 'json',
              success: (data) =&gt; {
  
            $.each(data, function (key, value) {
  
            //PRINTING TO SCREEN IMAGE AND RECORD DATA                          
  
            station_data += '&lt;div class="store"&gt;' + '&lt;img 
            src="data:image/jpeg;charset=utf-8;base64,'+ 
            base64.encode(value.Image) +'" width="70" height="70"&gt;' + 
           '&lt;li&gt;ID: ' + value.ID + '&lt;/li&gt;' +
              '&lt;li&gt;Station: ' + value.Station + '&lt;/li&gt;' +
              '&lt;li&gt;Address: ' + value.Address + '&lt;/li&gt;' +
              '&lt;li&gt;Sales: ' + value['Monthly C-Store Sales'] + '&lt;/li&gt;' +
              '&lt;li&gt;Operator: ' + value.Operator + '&lt;/li&gt;' +
              '&lt;li&gt;Top SKU: ' + value['Top SKU'] + '&lt;/li&gt;' + '&lt;/ul&gt;' +
              '&lt;div class="store-action"&gt;' +
              '&lt;input type="hidden" value=\'' + JSON.stringify(value) + 
              '\'&gt;' +
              '&lt;a class="edit" href="http://localhost:5000/edit/' + value.ID 
              + '"&gt;Edit&lt;/a&gt;' + '  |  ' +
              '&lt;a class="delete" 
              href="http://localhost:5000/stationNames/number/' + value.ID + 
              '" id="del"&gt;Delete&lt;/a&gt;' +
              '&lt;/div&gt;';
          });
  
             $('#stores').append(station_data);
  
          }
         });
  
       } else {
      //console.log('It is not empty, data should not load');
      $('#stores').toggle();
    };
  });
  </code></pre>
  
  <p>});</p>