Skip to content

Support for running Tasks and Scripts

Compare
Choose a tag to compare
@skitsanos skitsanos released this 04 Nov 11:05
· 87 commits to master since this release

Example of using runTask

/**
 * Run Google Analytics on each API endpoint request
 */

module.context.use((req, res, next) =>
{
    const {runTask} = module.context;
    runTask(
        'Google Analytics PageView recording',
        'ga',
        {
            clientId: req.headers['x-bb-client-request-uuid'],
            path: req.path,
            headers: req.headers
        });

    next();
});