I have a table 'image' on MySQL database which has two columns namely 'ID'(INT) and 'path'(BLOB). I have a rows in database like below image:
I want to now show this image on the webpage. I am using Node-mysql-express-jade setup to do this.
I have index.js file which has a method to retrieve the tuple with id=1.
router.get('/homePage', function(req, res) {
db=mysql.createConnection(config);
db.connect(function(err){
});
var sql= "select * from image where ID=1";
db.query(sql,function(err_query,data){
if(err_query) console.log(err_query);
res.render(
'homePage',
{"homePage": data});
});
and I am passing this data to homePage.jade which has
extends layout
.body
block content
.home
p.home Searchable Index on Streaming Logs
</.home>
ul
for item in homePage
- if (item.path != undefined)
img(src='#{item.path}' width=100, height=100, alt='error!')
ul
.head Login
<br>
form#formAddUser(name="login",method="post",action="/sample")
input#inputUserName(type="text", placeholder="Enter Username here...", name="username")
<br>
input#inputpassword(type="text", placeholder="Enter Password here..", name="password")
<br>
button#btnSubmit(type="submit") Login
<br>
.loginerror= title
I am not able to display the image on the webpage instead getting the alt:error
can someone please let me know how can I get to display the image on the webpage??