我正在尝试使用 express 和 charlotte 构建一个应用程序。我正在使用 ejs 来呈现我的 html 文件。我有一个 css 的 twitter 引导程序。出于某种原因:
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="#"><img src="./img/MySpending.png"></a>
<div class="nav-collapse">
<ul class="nav">
<li ><a href="./login.html">Log in/out</a></li>
<li class="active"><a href="#">Daily</a></li>
<li ><a href="./monthly.html">Monthly</a></li>
<li ><a href="./yearly.html">Yearly</a></li>
</ul>
</div><!--/.nav-collapse -->
<div class='navbar_form pull-right'>
</div>
</div>
</div>
对我来说,我的 html 似乎不会快速更新。
如果有帮助,这是我的 app.js 快递:
var express = require('express');
var conf = require('./conf');
var everyauth = require('everyauth')
, Promise = everyauth.Promise;
everyauth.debug = true;
var mongoose = require('mongoose')
, Schema = mongoose.Schema
, ObjectId = mongoose.SchemaTypes.ObjectId;
var UserSchema = new Schema({})
, User;
var mongooseAuth = require('mongoose-auth');
var path = require('path');
UserSchema.plugin(mongooseAuth, {
everymodule: {
everyauth: {
User: function () {
return User;
}
}
}
, password: {
loginWith: 'email'
, extraParams: {
phone: String
, name: {
first: String
, last: String
}
}
, everyauth: {
getLoginPath: '/login'
, postLoginPath: '/login'
, loginView: 'login.jade'
, getRegisterPath: '/register'
, postRegisterPath: '/register'
, registerView: 'register.jade'
, loginSuccessRedirect: '/'
, registerSuccessRedirect: '/'
}
}
, google: {
everyauth: {
myHostname: 'http://localhost:3000'
, appId: conf.google.clientId
, appSecret: conf.google.clientSecret
, redirectPath: '/'
, scope: 'https://www.google.com/m8/feeds'
}
}
});
// Adds login: String
mongoose.model('User', UserSchema);
mongoose.connect('mongodb://localhost/mydb');
User = mongoose.model('User');
var app = express();/*express.createServer(
express.bodyParser()
, express.static(__dirname + "/public")
, express.cookieParser()
, express.session({ secret: 'esoognom'})
, mongooseAuth.middleware()
);*/
app.configure( function () {
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.engine('html', require('ejs').renderFile);
app.use(express.static(path.join(__dirname, 'public')));
});
app.get('/', function (req, res) {
res.render('index.html');
});
app.get('/monthly', function (req, res) {
res.render('monthly.html');
});
app.get('/yearly', function (req, res) {
res.render('yearly.html');
});
/*app.get('/logout', function (req, res) {
req.logout();
res.redirect('/');
});*/
mongooseAuth.helpExpress(app);
app.listen(3000);
所以我不确定是什么阻止了视图更新,因为它目前正在渲染一个旧版本,在导航中只有一个选项卡。对此的任何帮助将不胜感激。