<!doctype html>
<html lang="en">
<head>
<title>Document</title>
</head>
<body>
<%= helloWorld %>
<img src="./a.jpg" alt="" />
</body>
</html>
var express = require("express");
var app = express();
// ./views
// app.set("views", path.join("views"));
app.engine("html", require("ejs").renderFile);
app.set("view engine", "html");
/*app.get("/!*", function(req, res, next) {
console.log(req);
var referer = req.headers.referer;
console.log(referer);
if(referer.indexOf("localhost")===0){
// res.send("");
return;
}else{
next(); //,next ,
}
});*/
app.get("/", function(req, res) {
res.render("index", { helloWorld: "hello,world" });
});
app.listen(3000, function() {
console.log("app listen at 3000");
});
Why can"t the picture be rendered, showing 404