router.get('/', function(req, res) {
res.send('Hello World');
});
Sort of.
To be precise, the 'get' method in this case is being invoked with two parameters, a string (the web request path pattern to match), and a callback function (the code that should be executed when a request matches the pattern).
When the callback is called, the calling code (in this case, the get method provided by express) supplies whatever parameter signature it wants, which we discover by documentation or by logging the arguments object if the module writer wasn't so great at documentation.
Frequently callbacks have a signature of function(errorObject, resultObject), with on or the other being null depending on error condition. A lot of those go undocumented by module writers in my experience because they assume folk know the convention.
--
You received this message because you are subscribed to the Google Groups "Express" group.
To unsubscribe from this group and stop receiving emails from it, send an email to express-js+...@googlegroups.com.
To post to this group, send email to expre...@googlegroups.com.
Visit this group at https://groups.google.com/group/express-js.
For more options, visit https://groups.google.com/d/optout.