Session management in Nodejs
<p>I am beginner of NodeJS.And just started a simple project where I need a session management concept. So How to manage the session in NodeJS application.</p>

<p>In my project there is two file:- app.js and routes.js.</p>

<p>So where we add the session and how to add ??</p>

<p>app.js file :-</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var express = require('express'),
    app = express(),
    path = require('path');


app.set('views', path.join(__dirname , 'views'));
 
app.engine('html', require('hogan-express'));   
  
app.set('view engine', 'html');
  
app.use(express.static(path.join(__dirname,'public')));

require('./routes/routes.js')(express,app);

app.listen (3000 , function(){
    console.log("working on the Port 3000"); 
   
 });</code></pre>
</div>
</div>
</p>

<p>and routes.js file :-</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>module.exports = function(express, app){
    
    var router = express.Router();
    
    router.get('/', function(req , res , next){
       res.render('index',{title: 'Welcome'}); 
    });
    
  }</code></pre>
</div>
</div>
</p>