1//app.get will see only exact match ex.> "/book" here app.get will not allow /book/1, etc
2//but app.use is different see below
3
4//what is difference between app.use and app.all
5//app.use takes only 1 callback while app.all takes multiple callbacks
6//app.use will only see whether url starts with specified path But, app.all() will match the complete path
7
8app.use( "/book" , middleware);
9// will match /book
10// will match /book/author
11// will match /book/subject
12
13app.all( "/book" , handler);
14// will match /book
15// won't match /book/author
16// won't match /book/subject
17
18app.all( "/book/*" , handler);
19// won't match /book
20// will match /book/author
21// will match /book/subject
1const requestLogger = (request, response, next) => {
2 console.log('Method:', request.method)
3 console.log('Path: ', request.path)
4 console.log('Body: ', request.body)
5 console.log('---')
6 next()
7}