feat(trias-client): inital commit
This commit is contained in:
parent
01a185b5c6
commit
45edd56a19
|
@ -0,0 +1,2 @@
|
||||||
|
URL=https://fahrplaner.vbn.de/triasproxy/
|
||||||
|
REF=159b176d-ccce-4d08-915b-c444709b1891
|
|
@ -0,0 +1 @@
|
||||||
|
node_modules
|
|
@ -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.')
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
||||||
|
```
|
Loading…
Reference in New Issue