Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

app.configure(function){} typeerror undefined is not a function

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);
      });
like image 939
phillis Peters Avatar asked Apr 17 '15 08:04

phillis Peters


1 Answers

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.

like image 77
phillis Peters Avatar answered Oct 01 '22 17:10

phillis Peters