Skip to content

Instantly share code, notes, and snippets.

View a7v8x's full-sized avatar
🎮
maximizing reward function in the game of life

David Mraz a7v8x

🎮
maximizing reward function in the game of life
View GitHub Profile
import {
GraphQLSchema,
GraphQLObjectType,
} from 'graphql';
import {
userQueries,
userMutations,
} from './users/users';
import {
GraphQLString,
GraphQLID,
GraphQLInputObjectType,
GraphQLObjectType,
} from 'graphql';
export const UserType = new GraphQLObjectType({
name: 'UserType',
description: 'User type definition',
import {
GraphQLList,
GraphQLNonNull,
} from 'graphql';
import {
internet,
random,
} from 'faker';
query {
users {
id,
email
}
}
mutation {
createUser(userPayload: {
email: "david@atheros.ai"
}) {
id,
email
}
}
import express from 'express';
import graphqlHTTP from 'express-graphql';
import schema from './graphql/schema';
const app = express();
const dev = process.env.NODE_ENV === 'development';
app.use('/graphql', graphqlHTTP({
import {
GraphQLString,
GraphQLID,
GraphQLObjectType,
GraphQLNonNull,
} from 'graphql';
const UserType = new GraphQLObjectType({
name: 'User',
description: 'User type definition',
type User {
id: ID!
username: String!
email: String
phone: String
firstName: String
lastName: String
}
const userMutations = {
createUser: {
type: UserType,
args: {
input: {
type: new GraphQLNonNull(UserInputType),
},
},
resolve: async (rootValue, { input }) => {
mutation createUser {
createUser(input: {
username: "test",
email: "test@test.cz",
phone: "479332973",
firstName: "David",
lastName: "Test"
}) {
user {
id