This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
Closed
Homey HTTP support
I am proposing to add simple HTTP handling to Homey core.
I've built simple wrapper around node's http https://github.com/matjaz/homey-youtube/blob/master/lib/http.js
It uses promises which are already supported in node 0.12.9.
It supports all common HTTP methods.
Usage is as follows:
Comments welcome.
I've built simple wrapper around node's http https://github.com/matjaz/homey-youtube/blob/master/lib/http.js
It uses promises which are already supported in node 0.12.9.
It supports all common HTTP methods.
Usage is as follows:
var http = require('./http') http.get('http://httpbin.org/get') .then(function (result) { console.log('Status code: ' + result.response.statusCode) // raw ServerResponse object console.log(result.data) // response contents }) .catch(function (err) { console.error(err) }) // POST http.post('http://httpbin.org/post', {test: 'hello'}) .then(function (result) { console.log(result.data) }) .catch(function (err) { console.error(err) }) // built-in JSON parsing http.json('http://httpbin.org/get') .then(function (data) { console.log(data.url) // parsed JSON object }) .catch(function (err) { console.error(err) })
This discussion has been closed.
Comments
+10 for built in HTTP and JSON support!
AFAIK, all npm modules must be added directly to the app before publishing app. So each app has it's own copy of dependencies. App dependencies in app.json are not (yet?) used AFAIK.
What I suggest is add support directly calling methods of other apps (similar to api), but without http bridge.
For example
Homey.getApp('util.http', '~1.0.0').get('http://athom.com').then(...)
Other use case would be to Chromecast app to use YouTube app search functionality.
if Homey.appInstalled('com.youtube', '~1.0.0')
Homey.getApp('com.youtube', '~1.0.0').search('hello world').then(...)
We need versioning, since apps can became incompatible with new versions. See http://semver.npmjs.com
What is the benefit of sharing these dependencies? Space?
@Emile I suggest to look into adding support for npm install and optimise dependency handling between apps.
More interesting is apps that depends on other apps functionality.