Skip to content

Instantly share code, notes, and snippets.

@ssaumyaranjan7
Last active June 23, 2019 19:00
Show Gist options
  • Save ssaumyaranjan7/6e634982f044ce3766ec88a3e2f72f73 to your computer and use it in GitHub Desktop.
Save ssaumyaranjan7/6e634982f044ce3766ec88a3e2f72f73 to your computer and use it in GitHub Desktop.
This is the typedefs file
const { gql } = require('apollo-server-express');
const employeeType = gql`
# Defined the query type
type Query {
employees: [employee!]
employee(id: ID!): employee
}
# Defined the mutation type
type Mutation {
signUp(firstName: String!, lastName: String!,
email: String!, password: String! ): employee
update(id: ID!, firstName: String, lastName: String,
email: String, password: String ): employee
delete(id: ID!): employee
}
# Defined the employee type.
type employee {
id: ID!
firstName: String,
lastName: String,
email: String,
password: String
}
`;
module.exports = employeeType;
const { gql } = require('apollo-server-express');
// Created a gql type for the query structure
const messageType = gql`
# used extend type because one query is possible in one project
# and query is already defined in employee schema.
extend type Query {
hello: String
}
`;
module.exports = messageType ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment