Last active
June 23, 2019 19:00
-
-
Save ssaumyaranjan7/6e634982f044ce3766ec88a3e2f72f73 to your computer and use it in GitHub Desktop.
This is the typedefs file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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