final product
This commit is contained in:
29
server.js
29
server.js
@@ -1,7 +1,9 @@
|
||||
const express = require('express')
|
||||
const path = require('path');
|
||||
const app = express()
|
||||
const gtfsRealtime = require("./tools/gtfsData")
|
||||
const gtfsRealtime = require("./tools/gtfsRedis")
|
||||
const redisDAL = require("./tools/redisDAL");
|
||||
|
||||
app.use(express.static('public'))
|
||||
app.use((req, res, next) => {
|
||||
res.header('Access-Control-Allow-Origin', '*'); // or 'http://127.0.0.1:1001' for security
|
||||
@@ -88,6 +90,29 @@ app.get('/api/stop/:routeId', async (req, res) => {
|
||||
})
|
||||
|
||||
|
||||
app.listen(port, () => {
|
||||
app.listen(port, async() => {
|
||||
await redisDAL.connect()
|
||||
await test();
|
||||
console.log(`Example app listening on port ${port}`)
|
||||
})
|
||||
|
||||
|
||||
async function test(){
|
||||
console.log("stops")
|
||||
await gtfsRealtime.getStops()
|
||||
await gtfsRealtime.getStopsByRoute()
|
||||
await gtfsRealtime.getRoutes()
|
||||
console.log("trains")
|
||||
await gtfsRealtime.getTrains()
|
||||
await gtfsRealtime.getTrainsByRoute()
|
||||
console.log("buses")
|
||||
await gtfsRealtime.getBuses()
|
||||
await gtfsRealtime.getBusesByRoute()
|
||||
await gtfsRealtime.getShapeByRoute()
|
||||
await console.log("shapes")
|
||||
await gtfsRealtime.getScheduleByRoute()
|
||||
await gtfsRealtime.getScheduleByStationId()
|
||||
await gtfsRealtime.getAlerts()
|
||||
await gtfsRealtime.getAlertsByRoute()
|
||||
console.log("done")
|
||||
}
|
||||
Reference in New Issue
Block a user