I'm trying to build an app using express and charlotte. I'm using ejs to render my html files. I have a twitter bootstrap for the css. For some reason this:
<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>
To me it seems like my html won't update in express.
here's my app.js in express if that helps:
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);
So I'm not sure what's keeping the view from updating, because it currently is rendering an older version with only one tab in the nav. Any help with this would be greatly appreciated.
It turns out the problem was I had ejs in my public folder, which express was choosing to render over the view folder, I removed it and everything works fine now.