I have base64 image format from the backend and i want it to display in the front end using img tag
here's code
router.get('/image_front/:id', function(req, res){
Delivery.findById(req.params.id, function(err, x){
    if(err){
        res.send({'error': err})
    }else{
        let v = 'data:image/png;base64'+', '+ new Buffer.from(x.image_front.data).toString('base64')
        res.send(v)
    }
})
})
for the front end
<img id="sample" src="/image_front/<%=x._id%>" />
when the image source activated the link return the data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAKQAAA.. which working when i copy and paste the image into w3schools to check the data is not corrupted. and it seems the data is work but it won't display using image tag. i don't know what is wrong.
 
     
    