- 我有一个名为
image.jpg
存储在/public/images/images.jpg
express 文件夹中的位置的图像
我的快递程序如下::
var express = require('express')
, http = require('http')
, mysql = require('mysql'); // <---- HERE
var app = express();
var connection = mysql.createConnection({
host: 'localhost',
user: 'root',
password: "root",
database: 'test123'
});
connection.connect(); // <---- AND HERE
// all environments
app.set('port', process.env.PORT || 7005);
app.get('/',function(request,response){
connection.query('SELECT * FROM MyTable', function(err, rows, fields)
{
console.log('Connection result error '+err);
console.log('no of records is '+rows.length);
response.writeHead(200, { 'Content-Type': 'application/json'});
response.end(JSON.stringify(rows));
});
} );
http.createServer(app).listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
});
当我给出时,我无法从我存储的位置显示图像
http://54.218.73.244:7005/image.jpg
我的代码哪里出了问题