• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

feats/perfect-graphql-starter: a boilerplate for your GraphQL server

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

feats/perfect-graphql-starter

开源软件地址(OpenSource Url):

https://github.com/feats/perfect-graphql-starter

开源编程语言(OpenSource Language):

JavaScript 100.0%

开源软件介绍(OpenSource Introduction):

DEPRECATION NOTE:

This project has started a couple of years ago as we intended to create a way to allow developers to focus on building a structured domain based on well defined patterns instead of having the mess of loose uncoupled resolvers.

Unfortunately we haven’t had the proper time to develop this project further, so it has never gained enough momentum. Since then, as well, lots has changed in the ecosystem. A lot of the goals of this project have already been achieved by other projects, such as https://prisma.io.

Prisma is probably the way to go if you look for something mature and reliable. If you feel adventurous, though, you can take a look at our new experiment: https://github.com/zvictor/faugra.


Perfect GraphQL Starter

"Have no fear of perfection, you’ll never reach it." - Salvador Dali

Why

This project aims to be a place for the community to spread good practices and the use of related technologies.

It is inspired by the tutorial How to build a GraphQL server and its repository.

There will never be an agreement on a perfect boilerplate project for any technology we are aware of and it would not be different for a GraphQL-based project. But it doesn't mean we should not try to get as close as we can get from it. So please don't mind our pretentious project name, it's just a catchy one.

Install

As simple as that:

git clone https://github.com/Quadric/perfect-graphql-starter
cd perfect-graphql-starter
npm install
npm start

Getting started

(Run)

{
  getAuthor(_id: 2) {
    lastName
    posts {
      text
    }
  }
}
  • Hit the play button (cmd-return), then you should get this on the right side:
{
  "data": {
    "getAuthor": {
      "lastName": "Lombardi",
      "posts": [
        {
          "text": "Perfection is not attainable, but if we chase perfection we can catch excellence.",
        }
      ]
    }
  }
}

Examples

There is more you can try! Go back to the interactive tool and paste any of the following snippets there and check the result:

(Run)

{
  getAuthor(_id: 2) {  # Almost the same as
    firstName          # before, but with extra
    lastName           # fields.
    posts {
      title
      text
      views
    }
  }
}

(Run)

{
  getPostsByTitle(titleContains: "fear") {
    title               # Try adding the 'author'
    text                # field anywhere inside
    views               # this block ;)
  }
}

(Run)

{
  getPostsByAuthor(authorId:1) {  # This author has a private
    title                         # post. You should get an
    text                          # Authorization error.
    views
  }
}



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap