I am tying to get data from vk.com api via https protocol. like this (api vk docs):
var https = require('https');
https.get('https://api.vk.com/method/users.get?access_token=' + global['access_token'], function (d) {
var chunk = '';
d.on('data', function (data) {
chunk += data;
});
d.on('end', function () {
console.log(chunk);
});
}).on('error', function (e) {
console.error(e);
});
but in heroku logs I see
Error: Protocol:https: not supported.
So, how can I get this data? My app work in http protocol, this is config:
var express = require('express'),
routes = require('./routes');
var app = express();
app.configure(function () {
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));
});
app.configure('development', function () {
app.use(express.errorHandler());
});
app.get('/', routes.index);
http.createServer(app).listen(app.get('port'), function () {
console.log("Express server listening on port " + app.get('port'));
});
Node v0.8.9 added the functionality to make https.get() accept a URL.
Unless you have a very specific reason, use "node": "0.10.x" under engines in package.json.
Also try:
`var options = { host: 'api.vk.com', port: 443, path: '/method/users.get?access_token=' + global['access_token'] };
https.get('options', function(....`