We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3f5f700 commit cd59bf2Copy full SHA for cd59bf2
Lecture13/express-middlewares/server2.js
@@ -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
15
16
+function m3(req, res, next) {
17
+ console.log('middleware 3 running');
18
19
20
+function m4(req, res, next) {
21
+ console.log('middleware 4 running');
22
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