Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. const { gql } = require('apollo-server')
  2.  
  3. // type Query is the root query
  4. exports.typeDefs = gql`
  5. type User {
  6. username: String! @unique
  7. password: String!
  8. }
  9.  
  10. type Query {
  11. getAllUsers: User
  12. }
  13.  
  14. directive @requireAuth on FIELD_DEFINITION
  15.  
  16. extend type Query {
  17. me: String! @requireAuth
  18. user(userId: ID!):User!
  19. users: [User]!
  20. }
  21.  
  22. import { SchemaDirectiveVisitor } from "apollo-server";
  23.  
  24. export class YourCustomDirective extends SchemaDirectiveVisitor {
  25. // Your code for the directive
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement