知海

贡献指南:向 Code 页面添加项目

graphql-github-io-zh-Hans项目维护与贡献

贡献指南:向 Code 页面添加项目

你好,感谢阅读这些文档!

其次,我们希望对 GraphQL 生态系统中的所有库提供一份非常全面的概览。为了方便贡献者,Code 页面是根据本仓库中的一系列 Markdown 文件自动生成的。

sh 复制代码
$ tree src/content/code
src/content/code
├── language-support
│   ├── c-c
│   │   └── tools
│   │       └── libgraphqlparser.md
│   ├── clojure
│   │   ├── client
│   │   │   └── regraph.md
│   │   └── server
│   │       ├── alumbra.md
│   │       ├── graphql-clj.md
│   │       └── lacinia.md
│   ├── c-net
│   │   ├── client
│   │   │   ├── graphql-client.md
│   │   │   ├── graphql-net-client.md
│   │   │   └── sahb-graphqlclient.md
// etc

我们希望任何新项目都能包含几段描述其目标和用途的文字,这样可以方便人们在各种选项中做出选择。

下面是一个我们期望的理想示例:

  • 它使用 yml frontmatter 提供额外信息,如 repo、npm
  • 它先在 description 中说明自身,然后用一些代码示例补充该描述
md 复制代码
---
name: Express GraphQL
description: The reference implementation of a GraphQL API server over an Express webserver. You can use this to run GraphQL in conjunction with a regular Express webserver, or as a standalone GraphQL server.
url: /graphql-js/running-an-express-graphql-server/
github: graphql/express-graphql
npm: "express-graphql"
---

To run an `express-graphql` hello world server:

```bash
npm install express express-graphql graphql
```

Then run `node server.js` with this code in `server.js`:

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

var schema = buildSchema(`
  type Query {
    hello: String
  }
`);

var root = { hello: () => 'Hello world!' };

var app = express();
app.use('/graphql', graphqlHTTP({
  schema: schema,
  rootValue: root,
  graphiql: true,
}));
app.listen(4000, () => console.log('Now browse to localhost:4000/graphql'));
```

任何库/工具/服务在站点中都有最大高度限制,但是可以通过点击展开,所以如果你需要相当大的空间来说明你的项目,那也是可以的。

帮助我们改进文档

发现翻译问题或内容错误?请告诉我们。