🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

@pothos-examples/graphql-shield

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pothos-examples/graphql-shield

This example shows how you can create a simple plugin to apply graphql shield rules to your schema

3.1.8
latest
Version published
Weekly downloads
12
-47.83%
Maintainers
1
Weekly downloads
 
Created

A Simple Pothos API with a custom graphql-shield plugin

This example shows how you can create a simple plugin to apply graphql shield rules to your schema

This example uses the following packages:

  • @pothos/core: For building the schema
  • graphql-yoga: For creating a server that executes the schema

Schema

type Comment {
  author: User
  comment: String!
  id: ID!
  post: Post!
}

type Post {
  author: User
  comments: [Comment!]!
  content: String!
  id: ID!
  title: String!
}

type Query {
  post(id: ID!): Post
  posts(skip: Int, take: Int): [Post!]
  user(id: ID!): User
}

type User {
  comments: [Comment!]!
  firstName: String!
  fullName: String!
  id: ID!
  lastName: String!
  posts: [Post!]!
}

FAQs

Package last updated on 29 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts