From d7de2b173627a10264fe1687160994441c9ea044 Mon Sep 17 00:00:00 2001 From: "Begerad, Stefan" Date: Tue, 17 May 2022 15:29:14 +0200 Subject: [PATCH] feat: add query for service --- axios-get-trip/index.js | 44 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/axios-get-trip/index.js b/axios-get-trip/index.js index 8b3ff2b..5c35c8a 100644 --- a/axios-get-trip/index.js +++ b/axios-get-trip/index.js @@ -1,6 +1,6 @@ require('dotenv').config(); const axios = require('axios'); -const debug=require('debug')('axios'); +const debug=require('debug')('trips'); const URL=process.env.URL; debug('URL: '+URL) @@ -25,11 +25,51 @@ async function run() { debug('data received via GET'); debug('dataGet: %s',dataGet); debug('dataGet.data.length: %s',dataGet.data.length); - debug('dataGet.data: %s',dataGet.data); debug('dataGet.data[0].ageny_name: %s',dataGet.data[0].agency_name); debug('dataGet.data[0].route_short_name: %s',dataGet.data[0].route_short_name); debug('dataGet.data[0].agency_id: %s',dataGet.data[0].agency_id); debug('dataGet.data[0].route_id: %s',dataGet.data[0].route_id); + + const service_id=dataGet.data[0].service_id; + debug('service_id: %s',service_id); + debug('dataGet.data[0].service_id: %s',dataGet.data[0].service_id); debug('dataGet.data[0].trip_id: %s',dataGet.data[0].trip_id); + + const queryService=`http://localhost:65534/service?serviceid=${service_id}`; + debug('queryService: '+queryService); + let dataService = await axios.get(queryService); + + debug('dataService received via GET'); + debug('dataService: %s',dataService); + debug('dataService.data.length: %s',dataService.data.length); + debug('dataService.data: %s',dataService.data); + + const monday=dataService.data[0].monday; + debug('monday: %s',monday); + + const tuesday=dataService.data[0].tuesday; + debug('tuesday: %s',tuesday); + + const wednesday=dataService.data[0].wednesday; + debug('wednesday: %s',wednesday); + + const thursday=dataService.data[0].thursday; + debug('thursday: %s',thursday); + + const friday=dataService.data[0].friday; + debug('friday: %s',friday); + + const saturday=dataService.data[0].saturday; + debug('saturday: %s',saturday); + + const sunday=dataService.data[0].sunday; + debug('sunday: %s',sunday); + + const start_date=dataService.data[0].start_date; + debug('start_date: %s',start_date); + + const end_date=dataService.data[0].end_date; + debug('end_date: %s',end_date); + }