feat(trias-client): inital commit

This commit is contained in:
dancingCycle 2023-02-14 12:24:51 +01:00
parent 01a185b5c6
commit 45edd56a19
6 changed files with 1084 additions and 0 deletions

2
trias-client/.env Normal file
View File

@ -0,0 +1,2 @@
URL=https://fahrplaner.vbn.de/triasproxy/
REF=159b176d-ccce-4d08-915b-c444709b1891

1
trias-client/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

36
trias-client/index.js Normal file
View File

@ -0,0 +1,36 @@
require('dotenv').config();
const debug=require('debug')('debug');
const trias = require("trias-client");
const URL=process.env.URL||'URL';
debug('URL: '+URL)
const REF=process.env.REF||'REF';
debug('REF: '+REF)
var client = trias.getClient({
url: `${URL}`,
requestorRef: `${REF}`
});
run().catch(err => {
debug('run: error')
console.log(err)
});
async function run() {
debug('run:...')
var stopsResult = await client.getStops(
{
name: "am dobben"
}
);
debug('getStops() done.');
var departuresResult = await client.getDepartures(
{
id: stopsResult.stops[0].id
}
);
debug('getDepartures() done.');
debug('run: done.')
}

1013
trias-client/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

20
trias-client/package.json Normal file
View File

@ -0,0 +1,20 @@
{
"name": "trias-client",
"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.20"
},
"dependencies": {
"debug": "4.3.4",
"dotenv": "16.0.3",
"trias-client": "0.5.0"
}
}

12
trias-client/readme.md Normal file
View File

@ -0,0 +1,12 @@
## Preparation
Run the following command in your favorite terminal to install dependenies.
```
npm i
```
## Development setup
Run the following command to start the service in development mode.
```
DEBUG=$DEBUG,debug npm run dev
```