What does the "app.use" do in Express?

0 votes
Jul 3 by shubham
• 6,890 points
12 views

1 answer to this question.

0 votes

app.use() is mounted to the specific path. So whenever this route is hit it executes the function which is inside it gets executed.

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

app.use('/application', function(req, res, next){
   console.log("Request is recieved at " + Date.now());
   next();
});

app.get('/application', function(req, res){
   res.send('express');
});
app.listen(3000);

answered Jul 3 by sunshine
• 1,240 points

Related Questions

0 votes
2 answers

What is the use of @Override annotation in Java ? When do we use it ?

@Override annotation is used when we override ...READ MORE

answered Aug 14 in Java by Sirajul
• 25,180 points
89 views
0 votes
1 answer

Define a SQL query? What is the difference between SELECT and UPDATE Query? How do you use SQL in SAS?

Structured query language (SQL) is a programming ...READ MORE

answered Aug 24, 2018 in Data Analytics by Anmol
• 3,620 points
97 views
0 votes
1 answer

What does the return statement do in Python?

The print() function is use to write ...READ MORE

answered Oct 1, 2018 in Python by SDeb
• 13,160 points
67 views
+1 vote
1 answer

What does the Raise keyword do in Python?

Hi! I think I can answer this - ...READ MORE

answered Jan 25 in Python by Nymeria
• 3,520 points
62 views
0 votes
1 answer

What does the sink function do in R?

sink diverts R output to a connection ...READ MORE

answered May 24 in Data Analytics by Chandu
32 views
0 votes
1 answer

What does the random.triangular(low, high, mode) function do in python?

It returns a random floating point number ...READ MORE

answered May 27 in Python by Vinod
60 views
0 votes
1 answer

What to do when len() does not return the number of integers in range(1,100)?

You can use the following code block: x=range(1,100) len(x) Output: ...READ MORE

answered May 28 in Python by Fata
• 1,040 points
22 views
0 votes
1 answer

What does the map() method do in Python?

The map() function in Python is a ...READ MORE

answered Jun 17 in Python by anonymous
21 views
0 votes
1 answer

What does the penup() do in Python(turtle module)

penup() basically makes sure that the moving ...READ MORE

answered Jun 21 in Python by Iris
22 views
0 votes
1 answer

What does the operator "/=" do in python?

x = 20 res = x /= 5 print(res) The ...READ MORE

answered Aug 2 in Python by Mohammad
• 3,060 points
16 views