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

0 votes
Jul 3 by shubham
• 6,870 points
8 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,200 points

Related Questions

0 votes
1 answer

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

I think it is most useful as ...READ MORE

answered May 4, 2018 in Java by Akrati
• 3,150 points
70 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
55 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
• 12,360 points
47 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,500 points
53 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
19 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
31 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
• 620 points
19 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
16 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
15 views
0 votes
0 answers

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

Can you give an example? READ MORE

Jul 1 in Python by Waseem
• 3,480 points
6 views