Socket
Book a DemoInstallSign in
Socket

@pothos-examples/graphql-shield

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

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

npmnpm
Version
3.1.8
Version published
Maintainers
1
Created
Source

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