i am creating a chat application using socket.io and angularjs, when i run the app.js file using cmd, i get an error saying "app.configure(function){} typeerror undefined is not a function" what could be the problem?
my code looks like this:
var http = require('http');
var express = require('express'),
routes = require('./routes'),
socket = require('./routes/socket.js');
app = module.exports.app = express();
var server = http.createServer(app);
var io = require('socket.io').listen(server); //pass a http.Server instance
server.listen(80);
// Configuration
app.configure(function(){
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.set('view options', {
layout: false
});
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.static(__dirname + '/public'));
app.use(app.router);
});
i was using Express 4.0 in which configure was removed. See http://expressjs.com/guide/migrating-4.html#other-changes Simple mistake took me an hour to realise.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With