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.
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.
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) {
...
});
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