From fd9beb5eaa34e24546b51c649ae6c18aa3a6be6e Mon Sep 17 00:00:00 2001 From: Reaper Gelera Date: Wed, 7 Feb 2024 10:04:51 +0530 Subject: [PATCH] feat: add in route properties --- index.js | 3 ++- lib/routes.js | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index e1b89de0..b62d6958 100644 --- a/index.js +++ b/index.js @@ -210,7 +210,8 @@ const mercurius = fp(async function (app, opts) { entityResolversFactory: undefined, subscriptionContextFn, keepAlive, - fullWsTransport + fullWsTransport, + additionalRouteProps: opts.additionalRouteProps }) } diff --git a/lib/routes.js b/lib/routes.js index a6ab508b..4be90998 100644 --- a/lib/routes.js +++ b/lib/routes.js @@ -200,7 +200,8 @@ module.exports = async function (app, opts) { persistedQueryProvider, allowBatchedQueries, keepAlive, - fullWsTransport + fullWsTransport, + additionalRouteProps } = opts // Load the persisted query settings @@ -293,6 +294,7 @@ module.exports = async function (app, opts) { method: 'GET', schema: getSchema, attachValidation: true, + ...additionalRouteProps, handler: async function (request, reply) { // Generate the context for this request if (contextFn) { @@ -338,7 +340,8 @@ module.exports = async function (app, opts) { app.post(graphqlPath, { schema: postSchema(allowBatchedQueries), - attachValidation: true + attachValidation: true, + ...additionalRouteProps }, async function (request, reply) { // Generate the context for this request if (contextFn) {