Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following Block replaces the id parameter to 2 and logs the change.

Code Block
languagejs
var Arrow = require('arrow');

var PreBlock = Arrow.Block.extend({
    name: 'pre_example',
    description: 'will set a header named "Foo"',

    execute: function(req, res, next) {
        req.params.id = 2;
        req.log.info("Changing params.id to 2");
        next();
    }
});

module.exports = PreBlock;