为什么导航栏上的其他标签不会出现在我的快递应用中?

时间:2013-07-20 22:43:07

标签: html5 node.js twitter-bootstrap express ejs

我正在尝试使用express和charlotte构建应用程序。我正在使用ejs来渲染我的html文件。我有一个针对css的twitter bootstrap。出于某种原因:

<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 in express如果有帮助:

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);

所以我不确定是什么让视图不能更新,因为它目前正在渲染旧版本,导航中只有一个标签。对此的任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

事实证明问题是我在我的公共文件夹中有ejs,表示选择在视图文件夹上渲染,我删除了它,现在一切正常。