var Twit = require('twit');
var config = require("../config");

exports.twitterFeed = function (req, res) {
    var twitter = new Twit(config);
    var name = req.query.name;
    var start = process.hrtime();
    twitter.get('statuses/user_timeline', { screen_name: name, count: 10 }, function (err, data, response) {
        var end = process.hrtime(start);
        console.log(end[1]/1000000);
        res.render('twitterFeed', { title: 'nodejs', screen_name: name, tweets: data, elapsed: end[1] / 1000000 });
    });
    //res.render('twitterFeed', { title: 'nodejs', screen_name: name });
};