【发布时间】:2017-06-30 18:01:08
【问题描述】:
这是我的代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Home Page</title>
</head>
<body>
<img src="resources/mainlogo.png" style="width:304px;height:228px;">
<h1>Welcome to our user management application</h1>
<h3>Please see links below to navigate our homepage</h3>
<a href = /adduser>Create new user</a>
<a href = /users>List users</a>
</body>
</html>
所有除了图片都会显示
这是我的文件结构:
index.html
resources
mainlogo.png
我做错了什么?
这是渲染代码
app.get('/', function (req, res) {
// render main page
res.sendFile(__dirname + "/index.html");
});
这也是来自控制台的错误
Error http://localhost:8000/resources/mainlogo.png 404 (Not Found)
尽管图片在资源文件夹中。
【问题讨论】:
-
我想我正在感知可能出现的问题。也许我需要单独实现 get 来发送图像?
标签: javascript html css node.js express