`Nodejs - Express` - getting error as `ReferenceError: bodyparser is not defined`
<p>I am calling the <code>config</code> file from <code>server.js</code>. when i call the <code>config</code> file, I am getting the error as <code>ReferenceError: bodyparser is not defined</code>. I don't understand the wrong with my end.</p>

<p>any one help me to sort this?</p>

<p>here is my config file :</p>

<pre><code>var 

path = require('path'),
routes = require('./routes'),
exphbs = require('express-handlebars'),
express = require('express'),
bodyParser = require('body-parser'),
cookieParser = require('cookie-parser'),
morgan = require('morgan'),
methodOverride = require('method-override'),
errorHandler = require('errorhandler');


module.exports = function(app) {

    app.use(morgan('dev'));

    app.use(bodyParser({
        uploadDir:path.join(__dirname, 'public/upload/temp')
    }));

    app.use(methodOverride());

    app.use(cookieParser('some-secret-value-here'));
    routes(app);

    app.use('/public/', express.static(path.join(__dirname, '../public')));

    if ('development' === app.get('env')) {
        app.use(errorHandler());
    }

    return app;
};
</code></pre>

<p>server.js:</p>

<pre><code>var express = require('express'),
    config  = require('./server/configure'),
    app     = express();

app
    .set( "port", process.env.PORT || 3300 );

app
    .set( "views", __dirname + '/views');

app = config( app );

// app
//  .get('/', function( req, res ) {

//      res.send( 'Hello World' );

//  } );


app
    .listen( app.get('port'), function () {

        console.log('Server up: http://localhost:' + app.get('port'));

    })
</code></pre>

<p><strong>update</strong></p>

<pre><code>module.exports = function(app) {

    app.use(morgan('dev'));

    app.use(bodyParser.json());

    app.use(bodyParser.urlencoded({ extended: false }));

    app.use(bodyParser({
        uploadDir:path.join(__dirname, 'public/upload/temp')
    }));

    app.use(methodOverride());

    app.use(cookieParser('some-secret-value-here'));
    routes(app);

    app.use('/public/', express.static(path.join(__dirname, '../public')));

    if ('development' === app.get('env')) {
        app.use(errorHandler());
    }

    return app;
};
</code></pre>