使用车把时我的图像不显示

Tom*_*oke 2 html image src handlebars.js

下面是我的车把页面和文件结构的图像,我无法使用这些车把加载任何图像,不确定是什么原因造成的:

<div>
    <h1>HI</h1>
    <img src="images/normal.gif">
</div>
Run Code Online (Sandbox Code Playgroud)

主要扶手:

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Form validation</title>
    <meta charset="utf-8">
    <link rel="stylesheet" href="/public/css/style.css">
</head>
<body>
    
        {{{body}}}
    
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

我得到的错误是:

localhost/:12          GET http://localhost:3000/images/normal.gif 404 (Not Found)
Run Code Online (Sandbox Code Playgroud)

如果我使用完整路径,我会得到:

Not allowed to load local resource:
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

我不知道为什么这不起作用。我尝试过/images/normal.gif。还尝试添加属于人员文件夹一部分的其他图像,但它只显示损坏的图像。

Dha*_*ini 5

将 images 文件夹放入 public 文件夹中,并将其注册到 index.js 文件中。

app.use("/images", express.static(path.join(__dirname, "/public/images")));
Run Code Online (Sandbox Code Playgroud)

然后使用图像

app.use("/images", express.static(path.join(__dirname, "/public/images")));
Run Code Online (Sandbox Code Playgroud)