在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):notrab/fakerql开源软件地址(OpenSource Url):https://github.com/notrab/fakerql开源编程语言(OpenSource Language):TypeScript 100.0%开源软件介绍(OpenSource Introduction):FakerQLFakerQL was created for frontend developers and GraphQL powered apps. Whether you're getting started with a new project or learning Relay/Apollo, you can forget about building a custom server and rely on Faker.js to provide some goodies! Give it a tryYou can head over to GraphiQL to send some example queries and mutations. QueriesGet authorised userYou can request the logged in user provided you pass a valid # me
{
me {
id
firstName
lastName
email
avatar
}
} Get a list of usersYou can request a list of users. # allUsers(count: Int)
{
allUsers(count: 5) {
id
firstName
lastName
email
avatar
}
} Get a UserYou can request a single User by providing any ID. # User(id: String!)
{
allUsers(id: "wk0z1j1tzj7xc0116is3ckdrx") {
id
firstName
lastName
email
avatar
}
} Get a list of productsYou can request a list of products. # allProducts(count: Int)
{
allProducts(count: 5) {
id
name
price
}
} Get a ProductYou can request a single Product by providing any ID. # Product(id: String!)
{
allProduct(id: "cjbrygtdz3e480147hv8ozt40") {
id
name
price
}
} Get a list of todosYou can request a list of todos. # allTodos(count: Int)
{
allTodos(count: 5) {
id
title
completed
}
} Get a TodoYou can request a single Todo by providing any ID. # Todo(id: String!)
{
Todo(id: "cjbrygq0u3e4301476mfqoaae") {
id
title
completed
}
} Get a list of postsYou can request a list of posts. # allPosts(count: Int)
{
allPosts(count: 5) {
id
title
body
published
createdAt
author {
id
firstName
lastName
avatar
}
}
} Get a PostYou can request a single Post by providing any ID. # Post(id: String!)
{
Post(id: "cjbryfb1x3e3c0147f4f4110o") {
id
title
body
published
createdAt
author {
id
firstName
lastName
avatar
}
}
} MutationsRegister userRegistering a User returns a random signed JWT. # register(email: String!, password: String!, expiresIn: String)
mutation {
register(email: "[email protected]", password: "F4K3rqL!", expiresIn: '24h') {
token
}
} Login userLogging in a User returns a random signed JWT. # login(email: String!, password: String!, expiresIn: String)
mutation {
login(email: "[email protected]", password: "F4K3rqL!") {
token
}
} Updating userThis mutation returns the updated data you passed in to update. # updateUser(id: ID!, email: String!, firstName: String, lastName: String)
mutation {
updateUser(id: "wk0z1j1tzj7xc0116is3ckdrx", firstName: "Jim") {
id
firstName
lastName
}
}
Create TodoThis mutation returns the data you sent arguments + a fake ID. # createTodo(title: String!, completed: Boolean)
mutation {
createTodo(title: "Book movie tickets") {
id
title
completed
}
} SubscriptionsComing soon. Client side library exampleThe example below uses graphql-request. import { request } from 'graphql-request';
const query = `{
products: allProducts(count: 25) {
id
name
price
}
user: User(id: "wk0z1j1tzj7xc0116is3ckdrx") {
id
firstName
lastName
email
avatar
}
}`;
request('https://fakerql.com/graphql', query).then(data => console.log(data)); Todo
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论