не показывает изображение хотя есть app.use('/smart/', express.static(__dirname + '/f
не показывает изображение
вот код var express = require('express'); var mysql = require('mysql'); const fileUpload = require('express-fileupload'); var app = express(); const bodyParser = require("body-parser"); cookies = require('cookie-parser'); app.use(cookies()); app.use(fileUpload()); /// /// Create connection to MySQL database server. /// function getMySQLConnection() { return mysql.createConnection({ host : 'localhost', user : 'mysql', password : 'mysql', database : 'elektronika' }); } const urlencodedParser = bodyParser.urlencoded({extended: false}); app.set('view engine', 'ejs'); /// app.use('/smart/', express.static(__dirname + '/files/sphoto/')); app.get('/smart/', (req, res) => { var connection = getMySQLConnection(); var smartphone=[]; var allprice=0; var sql1 ='SELECT `id`,`prod`,`name`,`price`, `photo` FROM `smartphone` WHERE id=2'; connection.connect(function(err) { if(err){ console.log(err); }else{ connection.query(sql1,[] , function (errr, resulta) { length=resulta.length; if(errr){ console.log(errr); }else{ // Create the object to save the data. var smart = { 'id': resulta[0].id, 'prod': resulta[0].prod, 'name': resulta[0].name, 'photo': resulta[0].photo, 'price': resulta[0].price, }; smartphone.push(smart); console.log(smartphone); } res.render('smart', {"smartphone": smartphone}); }); }; }); }); app.listen(3000, function () { console.log('listening on port', 3000); }); |
Часовой пояс GMT +3, время: 02:19. |