gql-schema-cli
v1.0.1
Published
You can easily generate graphql schema.
Downloads
2
Readme
gql-schema-cli
You can easily generate graphql schema.
Installation
npm install gql-schema-cli
Useage
gsc tpl createAccount
---
users/createAccount/createAccount.resolvers.js creation complete
users/createAccount/createAccount.typeDefs.js creation complete
Options
root
root folder name
- default: users
type
scheme type: Query | Mutation
- default: Query
Template
{{root}}/{{schema}}/{{schema}}.resolvers.js
import client from '../../client'
import { protectedResolver } from '../users.utility'
const {{schema}}ResolverFn = async (
_,
{ },
{ loggedInUser }
) => {
if () {
return {
ok: true,
}
} else {
return {
ok: false,
error: '.',
}
}
}
export default {
Mutation: {
editProfile: protectedResolver({{schema}}ResolverFn),
},
}
{{root}}/{{schema}}/{{schema}}.typeDefs.js
import { gql } from 'apollo-server'
export default gql`
type {{schema}}Result {
ok: Boolean!
error: String
}
type {{type}} {
editProfile(
firstName: String
lastName: String
username: String
email: String
password: String
bio: String
avatar: Upload
): {{schema}}Result!
}
`