2.0.2 • Published 7 years ago

koa-newrelic-route v2.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

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

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.0

7 years ago