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

https://github.com/konsumer/graphql-now-builder

Quickly build a graphql server on now.sh, from a simple config file.
https://github.com/konsumer/graphql-now-builder

Last synced: about 1 year ago
JSON representation

Quickly build a graphql server on now.sh, from a simple config file.

Awesome Lists containing this project

README

          

# graphql-now-builder

a [now builder](https://zeit.co/docs/v2/deployments/builders/overview/) for graphql services

## usage

create an `index.js` file

```js
module.exports = {
typeDefs: `
type Query {
hello: String
}
`,
resolvers: {
Query: {
hello: () => `hello world`
}
}
// any other apollo-server config
}
```

where `typeDefs` is a string that decscribes your schema, then create a `now.json` file

```json
{
"version": 2,
"builds": [
{ "src": "index.js", "use": "graphql-now-builder" }
],
"routes": [
{ "src": "/graphql", "dest": "index.js" }
]
}
```

then run `now` to deploy with [now](https://now.sh/).

Since you can use any [apollo-server](https://www.apollographql.com/docs/apollo-server/api/apollo-server.html) config, feel free to use `schema` or anything else you might do with that.

The default path is `/graphql`, but you can change that by adding `path` to your server, and updating your route in `now.json` to point to it.