我想發送.jog圖像到客戶端,但我失敗了。如何提供圖像到客戶端nodejs和角
app.get('/image', function(req, res){;
res.sendfile(path.resolve(path.resolve(__dirname,'/Imagepath/image.jpg")));
});
在我的角側
$http({
method:'GET',
url:'/image',
}).then(function (response){
$scope.image= response.data;
})
<img id="imgid" ng-src="{{image}}" width="500" height="400"/>
的問題是,該響應是一些二進制數據。我怎樣才能讓它發送可以顯示在img src上的數據。如何在客戶端的服務器文件夾中顯示圖像?謝謝。