feat(service-overview): initial commit
This commit is contained in:
parent
4dc68d6661
commit
e4a25a851a
|
@ -0,0 +1 @@
|
||||||
|
.env*
|
|
@ -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
|
|
@ -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.')
|
||||||
|
}
|
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue