GraphQL.js All In One

GraphQL.js All In One

image

https://graphql.org/

js

https://graphql.org/code/

Server

https://github.com/graphql/graphql-js

https://github.com/apollographql/apollo-server

Client

https://github.com/apollographql/apollo-client

https://github.com/facebook/relay

Tools

Generate code from your GraphQL schema and operations with a simple CLI

https://the-guild.dev/graphql/codegen

image

demos

$ npm install express express-graphql graphql --save

var express = require('express');
var { graphqlHTTP } = require('express-graphql');
var { buildSchema } = require('graphql');

// Construct a schema, using GraphQL schema language
var schema = buildSchema(`
  type Query {
    hello: String
  }
`);

// The root provides a resolver function for each API endpoint
var root = {
  hello: () => {
    return 'Hello world!';
  },
};

var app = express();
app.use('/graphql', graphqlHTTP({
  schema: schema,
  rootValue: root,
  graphiql: true,
}));
app.listen(4000);
console.log('Running a GraphQL API server at http://localhost:4000/graphql');

https://graphql.org/graphql-js/

https://graphql.org/graphql-js/running-an-express-graphql-server/

refs

https://www.npmjs.com/package/graphql

https://github.com/graphql/graphql-js

https://github.com/graphql/graphiql

https://graphql.org/users/



©xgqfrms 2012-2020

www.cnblogs.com/anonymous007 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️anonymous007, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2022-12-13 11:09  anonymous007  阅读(31)  评论(0编辑  收藏  举报