简体   繁体   English

app.configure(function){} typeerror undefined不是函数

[英]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? 我正在使用socket.io和angularjs创建一个聊天应用程序,当我使用cmd运行app.js文件时,我收到一条错误消息“app.configure(function){} typeerror undefined不是函数”可能是什么问题?

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. 我正在使用Express 4.0,其中删除了配置。 See http://expressjs.com/guide/migrating-4.html#other-changes Simple mistake took me an hour to realise. 请参阅http://expressjs.com/guide/migrating-4.html#other-changes简单的错误让我花了一个小时才意识到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM