我正在處理一個node.js應用程序,該應用程序正在通過路徑提供index.ejs頁面。 index.js(這是一個路線)ejs模板頁面沒有反映expressjs(node.js)應用程序中的更改
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/', function(req, res) {
res.render('index', { title: 'Express', clicks: req.app.get('clicks')});
});
module.exports = router;
index.ejs文件:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The HTML5 Herald</title>
<meta name="description" content="The HTML5 Herald">
<meta name="author" content="SitePoint">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="/stylesheets/style.css">
</head>
<body>
<div class="container">
<h1>
<%=title%>
</h1>
<div class="page">
</div>
</div>
<!-- <template id="click-list-template">
<table class="table striped">
<thead>
<th>
<td>day</td>
<td>hour</td>
<td>minute</td>
<td>count</td>
</th>
</thead>
<tbody>
<% _.each(clicks, function(click){%>
<tr>
<td><%=click.get('day')%></td>
<td><%=click.get('hour')%></td>
<td><%=click.get('minute')%></td>
<td><%=click.get('count')%></td>
</tr>
<%});%>
</tbody>
</table>
</template> -->
<script>
var dash = {};
dash.clicks = <%=clicks%>
</script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>
<!-- <script src="/javascripts/index.js"></script> -->
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
</body>
</html>
這是工作完全正常,直到最近。現在它只是不斷抱怨styles.css不加載,並且'_'未定義。但是,我從不同的目錄加載style.css,而不是它的抱怨,這是早期工作。現在無論我對ejs文件做出什麼改變,包括評論整個文件。它不斷顯示完全相同的錯誤。另外,我嘗試了多次重啓服務器,沒有任何運氣。
將不勝感激任何幫助。看起來像服務器端緩存問題給我,但不知道如何解決它。我google搜索,但找不到任何東西,因此張貼在這裏。
在此先感謝!