flightstats / node-datahub Goto Github PK
View Code? Open in Web Editor NEWClient for FlightStats DataHub
Client for FlightStats DataHub
Continuing the ongoing conversation around channelUrls vs channel names. See #12
It is deprecated
It would be nice to handle all errors as promise rejections instead of adding an extra try-catch block which probably duplicates the error handling code.
Most of the "public" methods on node-datahub build a url given a channel name.
getContent takes a channelUrl? This seems out of place.
Datahub.prototype.getContent = function(channelUrl){
if (!channelUrl){
throw new Error('Missing channel URL');
}
return this._crud(this.config.url + channelUrl, 'GET');
};
Datahub.prototype.getStatus = function(name){
if (!name){
throw new Error('Missing channel name');
}
return this._crud(this.config.url + '/channel/' + name + '/status', 'GET');
};
node-datahub currently handles promises. It catches errors generated by request-promise and returns status codes or it handles resolved promises.
This is problematic. It means that errors have to be caught with "then" and that non-errors sometimes return data that does not reflect what the datahub api specifies.
I tried to create a group callback with a startItem and got all bamboozled. Turns out it was being dropped by the client.
We have a channel that returns csv data. Because we set json:true the hub returns a 406.
There is a private repo here which appears to have similar functionality. Perhaps a merger is possible? Seems like we should favor FOSS in this case.
On the rare occasions the HUB might be unavailable, dropping a POST call (as an example) to the HUB as a result might be undesirable. This library should have some configurable retry method(s) available to the client.
https://github.com/flightstats/node-datahub/blob/master/src/hub-watcher.js#L43
I'd argue that the client shouldn't need to be aware of its environment for this sort of config. The implementation can perform env-driven logic and pass in a much simpler config. This discovery was driven by some dockerification that requires some fancy config overrides. Thoughts?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.