feat(service-overview): initial commit

This commit is contained in:
dancingCycle 2022-05-28 18:37:15 +02:00
parent 4dc68d6661
commit e4a25a851a
4 changed files with 71 additions and 0 deletions

1
service-overview/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.env*

View File

@ -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

29
service-overview/index.js Normal file
View File

@ -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.')
}

View File

@ -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"
}
}