aerogear / aerogear/create-graphql

Support raw GraphQL Mutation

Aberta
#21 1 comentário 0 reações 0 responsáveis Ver no GitHub
help wanted new feature
Linguagem predominante
JavaScript
Estrelas
438
Forks
35
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

Example of raw graphql mutation based on https://learngraphql.com/basics/defining-mutations/2

```jsx
const Mutation = new GraphQLObjectType({
name: "BlogMutations",
description: "Mutations of our blog",
fields: () => ({
createPost: {
type: Post,
args: {
title: {type: new GraphQLNonNull(GraphQLString)},
content: {type: new GraphQLNonNull(GraphQLString)}
},
resolve: function(source, args) {
let post = Object.assign({}, args);
// Generate the _id
post._id = `${Date.now()}::${Math.ceil(Math.random() * 9999999)}`;
// Assign a user
post.author = "arunoda";

// Add the Post to the data store
PostsList.push(post);

// return the new post.
return post;
}
}
})
});
```

I think this could work on apollo as well

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.