我只是跟着從http://scotch.io/bar-talk/setting-up-a-mean-stack-single-page-application如何使用Angular.js處理頁面刷新?
本教程介紹了控制器和服務angular.js一個單頁的應用程序的設置..
當我直接瀏覽/網頁,或點擊錨鏈接, /網頁的路線,然後按瀏覽器的「刷新」,頁面顯示:
Error: ENOENT, stat './public/views/index.html'
閱讀一些回答類似的問題後,我改變了:
app.get('*', function(req, res) {
res.sendfile('./public/views/index.html');
});
到:
res.sendfile(__dirname + '/public/views/index.html');
..though現在的結果是Error: ENOENT, stat '/app/app/public/views/index.html'
什麼是index.html的正確完整路徑? –
/Users/username/appMainFolder/public/index.html on our local comp .. app/public/index.html on heroku? – StackThis