【发布时间】:2019-10-05 19:32:41
【问题描述】:
尝试使用 NameCheap 共享主机启动 Simple Express 应用程序。
我已经按照此处NodeJS NameCheap Docs 的描述设置了我的 Node JS 应用程序
当前设置:
Application Root: url.com
Application URL: url.com
Application Startup File: server.js
我已经使用提供的按钮运行了 NPM 安装
我已尝试加载 URL http://url.com/hello 期望 Hello World 显示在页面中。
var express = require("express");
var app = express();
const port = 3001;
app.set("port", port);
app.get("/hello", function(req, res) {
res.send("hello world");
});
app.listen(app.get("port"), () =>
console.log("Started listening on %s", app.get("port"))
);
导航到http://url.com/hello 时得到的结果:
Not Found
The requested URL /index.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
【问题讨论】: