Skip to content

Commit cd59bf2

Browse files
middlewares
Signed-off-by: Arnav Gupta <[email protected]>
1 parent 3f5f700 commit cd59bf2

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const express = require('express')
2+
const app = express()
3+
4+
app.get('/favicon.ico', (req, res) => {
5+
res.sendStatus(404)
6+
})
7+
8+
function m1(req, res, next) {
9+
console.log('middleware 1 running');
10+
next();
11+
}
12+
function m2(req, res, next) {
13+
console.log('middleware 2 running');
14+
next();
15+
}
16+
function m3(req, res, next) {
17+
console.log('middleware 3 running');
18+
next();
19+
}
20+
function m4(req, res, next) {
21+
console.log('middleware 4 running');
22+
next();
23+
}
24+
25+
function m5(req, res) {
26+
console.log('middleware 5 running');
27+
res.send('End')
28+
}
29+
30+
app.use('/a', m1)
31+
app.use('/', m2)
32+
app.use('/a/b', m3)
33+
app.use('/a', m4)
34+
app.use('/', m5)
35+
36+
app.listen(8787)

0 commit comments

Comments
 (0)