I am learning Nodejs. I want to run two scripts(one is login and another is 
chat) in URL. When i run *npm start* command then my login page(app.js) is 
opened up and when i run *node index.js* command then my chat application 
work. I want my chat application to be work after login. So where i should 
specify my chat index.js so it will work. 


My app.js is here


var http = require('http');var express = require('express');var session = 
require('express-session');var bodyParser = require('body-parser');var 
errorHandler = require('errorhandler');var cookieParser = 
require('cookie-parser');var MongoStore = require('connect-mongo')(session);var 
routes = require('./routes/index');var users = require('./routes/users');var 
app = express();

app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/app/server/views');
app.set('view engine', 'jade');
app.use(cookieParser());
app.use(session({
secret: 'faeb4453e5d14fe6f6d04637f78077c76c73d1b4',
proxy: true,
resave: true,
saveUninitialized: true,
store: new MongoStore({ host: 'localhost', port: 27017, db: 'nodechat'})
 }));
  app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(require('stylus').middleware({ src: __dirname + '/app/public'    }));
app.use(express.static(__dirname + '/app/public'));

require('./app/server/routes')(app);
if (app.get('env') == 'development') app.use(errorHandler());

http.createServer(app).listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));});

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/d50b55e9-8681-4d02-92e0-ae75690a0c0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to