-2
なぜ画像がres.sendFileに読み込まれないのですか?ここにserver.jsファイルとred.htmlファイルがあります。私は、それ自体でred.htmlファイルをロードすると、画像が正確に表示さどうしてres.sendFile画像が読み込まれない
server.js
var express = require('express');
var app = express();
var http = require('http').Server(app);
app.use(express.static(__dirname + '/server'));
app.get('/', function(req, res){
console.log("hello");
res.sendFile('C:/Users/juniper/Documents/practiceCode/red.html');
});
app.post('/', function(req,res) {
res.send('post it all');
});
http.listen(3000, function(){
console.log('listening on localhost:3000');
});
red.html
<!DOCTYPE html>
<html>
<head>
<title>red screen</title>
</head>
<body>
<img src="red.png" usemap="#redmap">
<map name="redmap">
<area shape="rect" coords="0,0,1000,900" href="index.html">
</map>
<style>
img {
height: 100%;
width: 100%;
}
map {
position: absolute;
}
</style>
どうすれば処理できますか? – juniperWhite