diff --git a/service-overview/.gitignore b/service-overview/.gitignore new file mode 100644 index 0000000..e6905a2 --- /dev/null +++ b/service-overview/.gitignore @@ -0,0 +1 @@ +.env* \ No newline at end of file diff --git a/service-overview/README.md b/service-overview/README.md new file mode 100644 index 0000000..9c7a9a5 --- /dev/null +++ b/service-overview/README.md @@ -0,0 +1,21 @@ +## Overview + +tbc + +## Preparation +Run the following command in your favorite terminal to install dependenies. +``` +npm i +``` +## Development setup +Run the following command in your favorite terminal if you fancy log messages for debugging. +``` +export DEBUG=$DEBUG,debug +``` +Run the following command in your favorite terminal to start the service in development mode. +``` +npm run dev +``` +## Production deployment + +tbc diff --git a/service-overview/index.js b/service-overview/index.js new file mode 100644 index 0000000..f94ccbd --- /dev/null +++ b/service-overview/index.js @@ -0,0 +1,29 @@ +require('dotenv').config(); +const Axios=require('axios'); +const Debug=require('debug')('debug'); + +const URL=process.env.URL; +Debug('URL: '+URL) + +run().catch(err => { + Debug('run: error') + console.log(err) +}); + +async function run() { + Debug('run started...') + const res = await Axios.get(URL); + Debug('res: '+res); + if('data'in res){ + Debug('data available'); + const obj=res.data; + const len=Object.keys(obj).length; + Debug('len:'+len); + Object.entries(obj).forEach((obj,key)=>{ + Debug('agency:'+obj[0]+', route count:'+Object.keys(obj[1]).length); + }); + }else{ + Debug('data NOT available'); + } + Debug('run done.') +} diff --git a/service-overview/package.json b/service-overview/package.json new file mode 100644 index 0000000..0e42e7c --- /dev/null +++ b/service-overview/package.json @@ -0,0 +1,20 @@ +{ + "private": "true", + "name": "service-overview", + "version": "0.0.1", + "description": "", + "main": "index.js", + "scripts": { + "dev": "nodemon index.js", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Stefan Begerad", + "license": "GPL-3.0", + "devDependencies": { + "nodemon": "^2.0.7" + }, + "dependencies": { + "axios": "^0.21.1", + "dotenv": "^8.2.0" + } +}