【发布时间】:2017-02-01 07:50:40
【问题描述】:
这是代码文件夹
我使用 node js 并响应构建一个项目我使用 react 和控制器构建设计以获取数据我如何在服务器中提供 html 文件所以当运行 node server.js 它打开我创建的 html 页面我在服务器中尝试这个. js
app.get('/english', function(req, res) {
res.send(path.join(__dirname + '/index.html'));
});
当我运行这条路线localhost:3000/english时,我得到了这个
/home/projects/folder/folder2/myproject/index.html
【问题讨论】:
-
请阅读stackoverflow.com/help/how-to-ask您需要更详细地解释您的问题,然后才能回答。
-
没有。您需要至少提供您的代码Minimal, Complete, and Verifiable example
标签: javascript node.js reactjs express