FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
expresscpp/example/simple_rest_router_server.js at master · hpsware/expresscpp · GitHub
hpsware
/
expresscpp
Public
forked from
expresscpp/expresscpp
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
expresscpp
/
example
/
simple_rest_router_server.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (29 loc) · 681 Bytes
Breadcrumbs
expresscpp
/
example
/
simple_rest_router_server.js
Copy path
File metadata and controls
42 lines (29 loc) · 681 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
'use strict'
;
const
express
=
require
(
'express'
)
;
const
app
=
express
(
)
;
function
LoggerMiddleware
(
req
,
res
,
next
)
{
const
d
=
new
Date
(
)
;
const
n
=
d
.
getTime
(
)
;
console
.
log
(
n
)
;
next
(
)
;
}
app
.
use
(
LoggerMiddleware
)
;
app
.
route
(
'/t'
)
.
get
(
(
req
,
res
)
=>
{
console
.
log
(
'aasdfasf'
)
;
}
)
app
.
get
(
'/a'
,
(
req
,
res
)
=>
{
res
.
send
(
'a'
)
;
}
)
app
.
get
(
'/b'
,
(
req
,
res
)
=>
{
res
.
send
(
'b'
)
;
}
)
var
router
=
express
.
Router
(
)
app
.
use
(
'/subroute'
,
router
)
;
router
.
get
(
'/a'
,
(
req
,
res
)
=>
{
res
.
send
(
'a'
)
;
}
)
router
.
get
(
'/b'
,
(
req
,
res
)
=>
{
res
.
send
(
'b'
)
;
}
)
const
port
=
8081
;
app
.
listen
(
port
,
(
)
=>
console
.
log
(
`Example app listening on port
${
port
}
!`
)
)
;
Back
|
FazBrowse Home
|
New Git URL