@pothos-examples/simple-classes
TypeScript icon, indicating that this package has built-in type declarations

2.4.41 • Public • Published

A Simple Pothos API using data described by typescript classes

This example shows how to create a GraphQL API that exposes data defined by classes

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!]!
}

Readme

Keywords

none

Package Sidebar

Install

npm i @pothos-examples/simple-classes

Weekly Downloads

5

Version

2.4.41

License

none

Unpacked Size

14.3 kB

Total Files

10

Last publish

Collaborators

  • hayes