v1.1.0
Minor Changes
-
#130
c504479
Thanks @ryota-ka! - Parameterize the returned Middleware type so that this library can be used along with a context-parameterized Koa app.In order to utilize this feature, provide your Koa app's
State
andContext
types as type arguments to thekoaMiddleware
function.If you use a
context
function (for Apollo Server), theState
andContext
types are positions 1 and 2 like so:type KoaState = { state: object }; type KoaContext = { context: object }; koaMiddleware<GraphQLContext, KoaState, KoaContext>( new ApolloServer<GraphQLContext>(), //... { context: async ({ ctx }) => ({ graphqlContext: {} }), }, );
If you don't use a
context
function, theState
andContext
types are positions 0 and 1 like so:type KoaState = { state: object }; type KoaContext = { context: object }; koaMiddleware<KoaState, KoaContext>( new ApolloServer<GraphQLContext>(), //... );