Answer the question
In order to leave comments, you need to log in
How to fix nodejs output transliteration on heroku?
There is a small nodejs application that communicates with the vk api. Actually the express server raises the server, requests api and concludes:
app.get('/', function (req, response) {
vk.request('groups.getMembers', {
'group_id': '121314',
'count': 1000,
'fields': 'city'
});
vk.on('done:groups.getMembers', function(res){
var cityStat = {};
for (item in res.response.items){
var people = res.response.items[item];
if (typeof people.city !== 'undefined'){
if (typeof cityStat[people.city.title] == 'undefined'){
cityStat[people.city.title] = 1;
} else {
cityStat[people.city.title] += 1;
}
}
}
var sortedList = utils.sortObj(cityStat, 'asc')
response.end(JSON.stringify(cityStat, null, '\t'));
});
{
"Ярославль": 8,
"Москва": 62,
"Санкт-Петербург": 63,
}
{
"Yaroslavl": 7,
"Moscow": 62,
"Saint Petersburg": 63,
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question