Define variables in Javascript executing a local file

I have a node.js script which involves access tokens.

var T = new Twit({
consumer_key:         '...', 
,consumer_secret:      '...'
,access_token:         '...'
,access_token_secret:  '...'
})

I want to define this data with a script on the same folder, so I need to call it. Something similar to

execfile('keys.py')

in Python. I've tried

require('./keys.js')

but it didn't work.

Assign the file to a variable, as so:

var keys = require('./keys.js');

You should export the keys to a JSON file, read its contents with readFileSync and then parse the JSON:

var fs = require("fs");
var keysJson = fs.readFileSync("keys.json", "utf8");
var keys = JSON.parse(keysJson);

var T = new Twit(keys);

Note that you must pass the encoding ("utf8" in this case) to the readFileSync method, or else it will return a buffer instead of the file contents.