2
節點js + express在localhost上顯示效果很好。我的問題是,在顯示正在完成它的工作的靜態頁面之後,我的app.js腳本並未從外部世界中觸發。但是,在本地運行時,它的工作原理就像是假設的那樣。使用NODE JS和EXPRESS在公共互聯網上的App.js功能性損失
//send html page to user
app.use(express.static(__dirname + '/node_modules'));
app.use(express.static('public'));
app.get('/', function(req, res, next) {
res.sendFile(__dirname + '/index.html'); //send the file
});
//My app
// everything below this line does not work
我跟着從快車的方向但仍然app.js不是從外部世界發射。它再次擊中本地。任何幫助,將不勝感激!
https://expressjs.com/en/starter/static-files.html
「不發射」究竟意味着什麼? – zerkms
快遞功能無效後的任何內容。所以基本上我的節點服務器只是顯示我的HTML。 – Teamunicorn
爲什麼'node_modules'文件夾充當靜態內容? –