FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
VehicleTrackingSystem-FullStack/programs/api/api-server.js at main · helloakn/VehicleTrackingSystem-FullStack · GitHub
helloakn
VehicleTrackingSystem-FullStack
Repository navigation
Code
Issues
1
(1)
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
VehicleTrackingSystem-FullStack
/
programs
/
api
/
api-server.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
49 lines (38 loc) · 1.08 KB
Breadcrumbs
VehicleTrackingSystem-FullStack
/
programs
/
api
/
api-server.js
Copy path
File metadata and controls
49 lines (38 loc) · 1.08 KB
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
43
44
45
46
47
48
49
require
(
'dotenv'
)
.
config
(
)
;
const
express
=
require
(
"express"
)
;
const
cors
=
require
(
"cors"
)
;
const
config
=
require
(
'./app/config/lib.config.js'
)
;
express
.
application
.
prefix
=
express
.
Router
.
prefix
=
function
(
path
,
configure
)
{
var
router
=
express
.
Router
(
)
;
this
.
use
(
path
,
router
)
;
configure
(
router
)
;
return
router
;
}
;
const
app
=
express
(
)
;
var
corsOptions
=
{
origin
:
config
.
Origin
.
allowFrom
}
;
app
.
use
(
cors
(
corsOptions
)
)
;
// Parse URL-encoded bodies (as sent by HTML forms)
app
.
use
(
express
.
urlencoded
(
{
extended
:
true
}
)
)
app
.
use
(
express
.
json
(
)
)
// simple route
app
.
post
(
"/test"
,
function
(
req
,
res
)
{
console
.
log
(
req
.
body
)
;
res
.
json
(
{
message
:
req
.
body
}
)
;
}
)
;
// simple route
app
.
get
(
"/"
,
(
req
,
res
)
=>
{
res
.
json
(
{
message
:
"Welcome to Vehicle Tracking Admin API."
}
)
;
}
)
;
//require("./app/routes/authorization.routes.js")(app);
require
(
"./app/routes/index.routes.js"
)
(
app
)
;
// set port, listen for requests
const
PORT
=
process
.
env
.
SVR_PORT
||
8080
;
app
.
listen
(
PORT
,
(
)
=>
{
console
.
log
(
`Server is running on port
${
PORT
}
.`
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL