GraphQLBidigforGitHub
EmbedGitHub'sGraphQLAPIitoyourserverapplicatio
DeprecatioNotice!Ithelastfewmoths,sicethetrasitioofmaylibrariesuderTheGuild'sleadership,We'vereviewedadreleasedmayimprovemetsadversiostographql-cli,graphql-cofigadgraphql-import.
We'vereviewedgraphql-bidig,hadmaymeetigswithcurretusersadegagedthecommuityalsothroughtheroadmapissue.
Whatwe'vefoudisthattheewGraphQLMeshlibraryiscoverigotolyallthecurretcapabilitiesofGraphQLBidig,butalsothefutureideasthatwereitroduceditheorigialGraphQLBidigblogpostadhave'tcometolifeyet.
Adthebestthig-GraphQLMeshgivesyouallthosecapabilities,eveifyoursourceisotaGraphQLserviceatall!itcabeGraphQL,OpeAPI/Swagger,gRPC,SQLorayothersource!AdofcourseyoucaevemergeallthosesourcesitoasigleSDK.
JustlikeGraphQLBidig,yougetafullytypedSDK(thakstotheprotocolsSDKsadtheGraphQLCodeGeerator),butfromaysource,adthatSDKcaruaywhere,asacoectororasafullblowgateway.Adyoucashareyourow"MeshModules"(whichyouwouldprobablycall"yourowbidig")adourcommuityalreadycreatedmayofthose!Also,wedecidedtosimplyexposeregularGraphQL,soyoucachoosehowtocosumeitusigalltheawesomefluetclietSDKsoutthere.
Ifyouthikthatwe'vemissedaythigfromGraphQLBidigthatisotsupportediabetterwayiGraphQLMesh,pleaseletuskow!
Istallyaraddgraphql-bidig-githubExample(Demo)Seeexampledirectoryforfullexampleapplicatio.
cost{GitHub}=require('graphql-bidig-github')cost{GraphQLServer}=require('graphql-yoga')cost{importSchema}=require('graphql-import')costfavoriteRepos=[{ower:'graphcool',ame:'graphql-yoga'},{ower:'graphql',ame:'graphql-js'},]costtoke='__ENTER_YOUR_GITHUB_TOKEN__'costgithub=ewGitHub(toke)costtypeDefs=importSchema('schemas/app.graphql')costresolvers={Query:{hello:(paret,{ame})=>`Hello${ame||'World'}!`,favoriteRepos:(paret,args,cotext,ifo)=>{returPromise.all(favoriteRepos.map(args=>github.query.repository(args,cotext,ifo)),)},},//thefollowigiseededtomakeiterfaces,uios&customscalarswork...github.getAbstractResolvers(typeDefs),}costserver=ewGraphQLServer({resolvers,typeDefs})server.start(()=>cosole.log('Serverruigohttps://localhost:4000'))HowtocreateaGitHubTokeSimplyfollowthisguideadheadovertothetokesettigsoGitHub.
ResourcesGithubGraphQLExplorer:https://developer.github.com/v4/explorer/






评论