Notoriously Psychedelic Modules

npm

Need private packages and team management tools?Check out npm Orgs. »

koa-newrelic-route

2.0.2 • Public • Published

koa-newrelic-route

Explicity set name a to each newrelic transaction according to the matching Koa route.

Installation

If you use generator functions as route handlers then install:

npm i --save koa-newrelic-route@beta

If you async functions, or functions that return promises as route handlers then install:

npm i --save koa-newrelic-route@promises

Example

    const newrelicRoute = require('koa-newrelic-route');
    const newrelic = require('newrelic');
    
    const routes = {
        get: {
            '/api/v1/resource/1': function* () {
                this.status = 200;
            },
            '/api/v1/resource/2': function* () {
                this.status = 200;
            }
        },
        post: {
            '/api/v1/resource/1': function* () {
                this.status = 200;
            },
            '/api/v1/resource/2': function* () {
                this.status = 200;
            }
        }
    };
    
    newrelicRoute(routes, newrelic);
    

License

MIT

Keywords

install

npm i koa-newrelic-route

Downloadsweekly downloads

22

version

2.0.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability