Node.js Nodejs Express-can';找不到index.html

Node.js Nodejs Express-can';找不到index.html,node.js,express,Node.js,Express,这是我的代码目录的结构: myCode |-src |-Server.js |-public |-index.html |-myScript.js 我只是从myCode目录运行$node src/Server.js,如果我在broswer中输入地址localhost,我想查看index.html/reco文件 Server.js只有以下代码: var express = require('express'); var app = express(); app

这是我的代码目录的结构:

myCode
|-src
   |-Server.js
   |-public
      |-index.html
      |-myScript.js
我只是从myCode目录运行
$node src/Server.js
,如果我在broswer中输入地址
localhost
,我想查看
index.html/reco
文件

Server.js只有以下代码:

var express = require('express');
var app = express();
app.use('/reco', express.static(__dirname + '/src/public'));
app.listen(8080, function() { console.log('started');});
服务器正确启动,但浏览器中显示以下错误:

无法获取/记录


有什么建议吗?

解决方案是在app.use中更改路径。 应该仅为
/public/
,因为它从Server.js本身的位置开始读取