-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
25 lines (21 loc) · 795 Bytes
/
app.js
File metadata and controls
25 lines (21 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require('dotenv').load();
const MTA = require('./lib/mtaEngine');
const incomingTrains = require('./examples/incomingTrains');
const subwayStatus = require('./examples/subwayStatus');
const instance = new MTA();
instance.addFeed('l', (data) => {
const incoming = incomingTrains(data, 'L08');
console.log(incoming); // eslint-disable-line no-console
})
.then(() => {
// a feed has been requested and responded successfully.
// you can assume there is data and new requests can be subscribed to.
})
.catch((err) => {
console.log('An error occured on the first request', err); // eslint-disable-line no-console
});
// instance.getStatus()
// .then(res => {
// const t = subwayStatus(res, '123');
// console.log(t); // eslint-disable-line no-console
// });