Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using app.configure in express

People also ask

What is the use of app set in Express?

The app. set() function is used to assigns the setting name to value. You may store any value that you want, but certain names can be used to configure the behavior of the server.

Can Express be used for mobile app development?

js is an open-source server-side and mobile API application framework for Node. js. It simplifies the process of development by offering a set of useful tools, features, packages and plugins.

What is difference between app and router in Express?

Router class can be used to create modular mountable route handlers. A Router instance is a complete middleware and routing system; for this reason it is often referred to as a "mini-app"." Possible duplicate of What is the difference between "express. Router" and routing using "app.


It is optional and remain for legacy reason, according to the doc. In your example, the two piece of codes have no difference at all. http://expressjs.com/api.html#app.configure

Update 2015:

@IlanFrumer points out that app.configure is removed in Express 4.x. If you followed some outdated tutorials and wondering why it didn't work, You should remove app.configure(function(){ ... }. Like this:

var express = require('express');
var app = express();

app.use(...);
app.use(...);

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