Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/timneutkens/micro-graphql

Example usage of GraphQL with ZEIT's micro
https://github.com/timneutkens/micro-graphql

Last synced: 4 days ago
JSON representation

Example usage of GraphQL with ZEIT's micro

Awesome Lists containing this project

README

        

# Micro-graphql
Example usage of GraphQL with ZEIT's micro

## Installation

`npm install -g micro` or `yarn global add micro`

## Usage

Create an `index.js` file with the following contents:

```javascript
const { buildSchema } = require('graphql')
const graphqlHTTP = require('express-graphql')

const schema = buildSchema(`
type Query {
hello: String
}
`)

const rootValue = {
hello: () => 'Hello world'
}

module.exports = graphqlHTTP({
schema,
rootValue,
graphiql: true
})
```

Then run
`micro index.js`

## Boilerplates

[Kennet Postigo](https://github.com/kennetpostigo) made an excellent boilerplate based on the example above:
[hyperfuse/micro-graphql](https://github.com/hyperfuse/micro-graphql)

## Alternatives

[Micro with Apollo](https://github.com/timneutkens/micro-apollo)