FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
angular-nodejs-example/server.js at master · bibin-ecloudcontrol/angular-nodejs-example · GitHub
bibin-ecloudcontrol
angular-nodejs-example
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
angular-nodejs-example
/
server.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
27 lines (21 loc) · 630 Bytes
Breadcrumbs
angular-nodejs-example
/
server.js
Copy path
File metadata and controls
27 lines (21 loc) · 630 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
const
express
=
require
(
'express'
)
;
const
app
=
express
(
)
,
bodyParser
=
require
(
"body-parser"
)
;
port
=
3080
;
const
users
=
[
]
;
app
.
use
(
bodyParser
.
json
(
)
)
;
app
.
use
(
express
.
static
(
process
.
cwd
(
)
+
"/my-app/dist/angular-nodejs-example/"
)
)
;
app
.
get
(
'/api/users'
,
(
req
,
res
)
=>
{
res
.
json
(
users
)
;
}
)
;
app
.
post
(
'/api/user'
,
(
req
,
res
)
=>
{
const
user
=
req
.
body
.
user
;
users
.
push
(
user
)
;
res
.
json
(
"user addedd"
)
;
}
)
;
app
.
get
(
'/'
,
(
req
,
res
)
=>
{
res
.
sendFile
(
process
.
cwd
(
)
+
"/my-app/dist/angular-nodejs-example/index.html"
)
}
)
;
app
.
listen
(
port
,
(
)
=>
{
console
.
log
(
`Server listening on the port::
${
port
}
`
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL