When I download a third party module for example:
npm install twitter
How can I tell what functions/methods are available when I create an object. Example:
var twitter = require('twitter');
This also applies with the "hello world webserver" you commonly see with node.js
var http = require('http');
var server = http.createServer(function(req, res) {
res.writeHead(200);
res.end('Hello Http');
});
server.listen(8080);
Is there some command I can run on the http module to get a list of functions/methods like .createServer()
I could dig around for online documentation about the specific module but was hoping there was a command line way of simply retrieving a list of available functions/methods
Btw... in node.js what do they call them? Functions or Methods?
Did you try?
var http = require('http');
console.log(http)
To see what is in object there is also beautiful module called "util":
var util = require('util');
console.log(util.inspect(http))
util.inspect returns string representation of object.
At the node
prompt, just type:
require('twitter')
That will dump the function and data members of the module to the console.
The function and method terms are largely interchangeable in node.js.