-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
45 lines (32 loc) · 970 Bytes
/
app.js
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
//config env file
require('dotenv').config()
// importing requirements
const express = require("express")
const cookieParser = require("cookie-parser")
// init firebase services
const firebaseinit = require('./firebaseConfig.js')
//Routers
const postGpsData = require('./routers/postGpsDataRoute.js')
//--------------------------------------------------------//
//creating a server
const app = express()
// register view engine as ejs
app.set('view engine', 'ejs')
// cookie praser for access the browser cookie
app.use(cookieParser())
// static file
app.use(express.static('public'))
app.use(express.json())
app.use(express.urlencoded({
extended: true
}))
// PORT
const PORT = process.env.PORT || 8888
app.listen(PORT, () => { console.log('API Server.................ok') });
app.use('/',postGpsData)
app.use('/store/history',postGpsData)
app.use('/data',postGpsData)
// 404 Page
app.use((req, res) => {
res.status(404).send('404 No Route Found',)
});