beem be simple

Beems API. no auth, no ownership of items, just simple.

Get started

Install dependencies and run the app:

yarn install # or npm install
yarn start   # or npm start

Testing

Open your browser at http://localhost:4000 and start sending queries.

Query without name argument:

query {
  hello
}

The server returns the following response:

{
  "data": {
    "hello": "Hello World"
  }
}

Query with name argument:

query {
  hello(name: "Sarah")
}

The server returns the following response:

{
  "data": {
    "hello": "Hello Sarah"
  }
}

Implementation

This is what the implementation looks like:

import { GraphQLServer } from './graphql-yoga'
// ... or using `require()`
// const { GraphQLServer } = require('graphql-yoga')

const typeDefs = `
  type Query {
    hello(name: String): String!
  }
`

const resolvers = {
  Query: {
    hello: (_, { name }) => `Hello ${name || 'World'}`,
  },
}

const server = new GraphQLServer({ typeDefs, resolvers })
server.start(() => console.log('Server is running on localhost:4000'))