项目
在 GitHub 查看
howtographql/graphql-ruby
关于
GraphQL Ruby example for How To GraphQL
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- +1
- 15天
- +2
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文graphql-ruby
Installation
Install dependencies:
bundle install
rails db:setup
Starting the server:
rails server
Opening the application:
open http://localhost:3000/
Interesting Files:
- GraphqlController - GraphQL controller (api entry point)
- GraphqlTutorialSchema - the schema definition
- Mutations - root mutations
- Queries - root queries
- UserType - record type
- VoteType - record type
- LinkType - record type
- DateTimeType - scalar type
- LinksSearch - complex search resolver and its tests
- CreateLink - mutation and its tests
- CreateUser - mutation and its tests
- CreateVote - mutation and its tests
- SignInUser - mutation and its tests
Sample GraphQL Queries
List first 10 links, containing "example":
{
allLinks(first: 10, filter: {descriptionContains: "example"}) {
id
url
description
createdAt
postedBy {
id
name
}
}
}
Creates new user:
mutation {
createUser(
name: "Radoslav Stankov",
authProvider: {
credentials: { email: "[email protected]", password: "123456" }
}
) {
id
email
name
}
}
Creates new user token:
mutation {
signinUser(credentials: {email: "[email protected]", password: "123456"}) {
token
user {
id
email
name
}
}
}
Creates new link:
mutation {
createLink(url:"http://example.com", description:"Example") {
id
url
description
postedBy {
id
name
}
}
}
Creates new vote:
mutation {
createVote(linkId:"TGluay0yMQ==") {
user {
id
name
}
link {
id
url
description
}
}
}
探索相关项目
加载中…