可以't在html中打开src文件,因为路径没有'不存在

can't open src file in html because path doesn't exist

本文关键字:因为 路径 不存在 文件 html 可以 src      更新时间:2023-09-26

我在一个名为view的文件夹中有一个html文件,我使用node运行我的项目。node index.js,它使服务器使用total.js。服务器开始在http://127.0.0.1:8000/上运行。这一切都很好,除了当我试图在html:中包含一个脚本时

<script type="text/javascript" src="/path/to/js.js">

我在控制台中收到以下消息:

GET http://127.0.0.1:8000/path/to/js.js" 404 not found

检查文件是否存在:/your-app-directory/public/path/to/js.js

默认情况下,所有JavaScripts都路由到/your-app-directory/public/js/default.js