jeudi 16 avril 2015

Seemingly Long Request Times for NodeJS App

I have started building a small webapp, however compared to some of my previous projects the request time for pages is double or triple. I was wondering if it 200-300ms request times would be appropriate for the following app:



server.js
...
app.use(morgan('dev'));
app.use(bodyParser.urlencoded({extended: false}));
app.use(session({secret: 'anystringoftext',
saveUninitialized: true,
resave: true,
store: new MongoStore({ mongooseConnection: mongoose.connection,
ttl: 2 * 24 * 60 * 60 })}));

app.use(passport.initialize());
app.use(passport.session()); // persistent login sessions
app.use(flash()); // use connect-flash for flash messages stored in session

app.set('view engine', 'ejs');

var secure = express.Router();
require('./app/routes/secure.js')(secure, passport);
app.use('/', secure);


Secure.js



router.use(function(req, res, next){
if(req.isAuthenticated()){
return next();
}
res.redirect('/auth');
});
router.get('/home', function(req, res){
res.render('secured/home.ejs');
});


home.ejs is basically just the hello world angular application. It brings in bootstrap.min.css font-awesome.min.css angular.js


And thats it. I feel like the delay is due to one of the middlewares im using, but iv'e been unable to narrow it down. Anyone have any suggestions on how I may diagnose this problem? Or Maybe these are just typical request times and my previous projects have been exceptionally fast.


Thanks!


Aucun commentaire:

Enregistrer un commentaire