1.0.3 • Published 3 years ago

exegesis-plugin-context v1.0.3

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

exegesis-plugin-context

Run Status Coverage Badge npm.io npm.io npm.io

Description

An exegesis plugin to add a extra values to the request context

Installation

npm install exegesis-plugin-context

Example

Add this to your Exegesis options:

const exegesisContext = require( 'exegesis-plugin-context' );
const MyDataStore = require( './MyDataStore' );

var dataStore = new MyDataStore();

options = {
    plugins: [
        exegesisContext({
            dataStore: dataStore
        })
    ]
};

Within the handler for each operation you can access the provided values via the extraContext property:

async function myOperationHandler( context ) {
    return context.extraContext.dataStore.findItemsForRequest( context );
}

This is added during the postRouting phase so it is also available within authenticators.

1.0.3

3 years ago

1.0.2

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago