Skip to content

onursagir/graphql-middleware-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

graphQL-middleware-helper

A small helper that prevents you from having to type this

const authMiddleWare = {
  Query: {
    books: isAuthed,
    todos: isAuthed,
    someOtherResolver: isAuthed,
  },
  Me: isAuthed,
}

And instead lets u do this

// Will apply middleware to all resolvers
const authMiddleWare = middlewareHelper({ resolvers: yourResolvers, middleware: () => {} })

// Will apply middleware to all resolvers except all Mutation resolvers
const authMiddleWare = middlewareHelper({ resolvers: yourResolvers, middleware: () => {}, exclude: ['Mutation/*'] })

// Will only apple middleware to the Query -> book and Query -> todos resolvers
const authMiddleWare = middlewareHelper({ resolvers: yourResolvers, middleware: () => {}, include: ['Query/books', 'Query/todos'] })

Install

yarn add graphql-middleware-helper
npm install --save graphql-middleware-helper

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published