Iron:Router default hook

Consider the following Iron:Router function:

Router.route('/foo', function() {
   this.response.writeHead(302, {'Location': '/bar'});
   this.response.end();
}, {
   where: 'server'
});

What hook is the function in there?

I asked this since if I use:

Router.route('FooName', {
   path: '/foo',
   where: 'server',
   method: 'post',
  
   onBeforeAction: function() {
      this.response.writeHead(302, {'Location': '/bar'});
      this.response.end();
  }
});

The latter code have some error saying that header cannot be echoed after the body is printed, which makes sense. While the former works.

Again, out of curiosity. What is the hook in the first code?

It’s action. If you look at that part of the guide, it says “same as passing a function as the second parameter”.