Slide 26
Slide 26 text
Nodejs: Connect
middleware
Routing middleware is anything that implements the
request, response, and next function pattern.
/
/ R
e
q
u
e
s
t l
o
g
g
e
r
f
u
n
c
t
i
o
n l
o
g
g
e
r
(
r
e
q
, r
e
s
, n
e
x
t
) {
c
o
n
s
o
l
e
.
l
o
g
(
"
P
a
t
h r
e
q
u
e
s
t
e
d
: " + r
e
q
.
p
a
t
h
)
;
n
e
x
t
(
)
;
}
this middleware:
a
p
p
.
g
e
t
(
'
/
'
, l
o
g
g
e
r
, f
u
n
c
t
i
o
n
(
r
e
q
, r
e
s
) {
r
e
s
.
s
e
n
d
(
'
H
e
l
l
o W
o
r
l
d
'
)
;
}
)
;