-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
39 lines (36 loc) · 1.44 KB
/
index.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
const express = require('express')
const process = require('process')
const {
generateDocs,
nationStats,
latestNationStats,
stateStatistic,
latestStateStatistic,
latestLocalVaccinationRegStatistic,
localVaccinationRegStatistic,
latestStateVaccinationRegStatistic,
stateVaccinationRegStatistic,
getPopulationByState,
citfStandardStatistics
} = require('./handlers')
const { getStateLatestVaccinationStatistic } = require('./provider')
require('dotenv').config();
let server = express()
server.get('/', generateDocs)
let router = express.Router()
router.get('/docs', generateDocs)
router.get('/malaysia', nationStats)
router.get('/malaysia/latest', latestNationStats)
router.get('/malaysia/registration/', localVaccinationRegStatistic)
router.get('/malaysia/registration/latest', latestLocalVaccinationRegStatistic)
router.get('/state/registration/:state/', stateVaccinationRegStatistic)
router.get('/state/registration/:state/latest', latestStateVaccinationRegStatistic)
router.get('/state/:state', stateStatistic)
router.get('/state/:state/latest', latestStateStatistic)
router.get('/population/:state', getPopulationByState)
router.get('/citf-standard', citfStandardStatistics);
server.use("/api/vaccination/stats", router)
server.listen(process.env.EXPRESS_PORT, () => {
console.log(`Server listening on port ${process.env.EXPRESS_PORT}`)
console.log(`For docs please navigate to /api/vaccination/stats/docs path`)
})