https://github.com/ryanhs/graphql-koa-scripts
Apollo Graphql + Koa, just a simplified setup
https://github.com/ryanhs/graphql-koa-scripts
graphql graphql-koa-scripts koa2 nodejs
Last synced: 5 months ago
JSON representation
Apollo Graphql + Koa, just a simplified setup
- Host: GitHub
- URL: https://github.com/ryanhs/graphql-koa-scripts
- Owner: ryanhs
- Created: 2020-05-15T20:14:48.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-11-03T22:18:52.000Z (5 months ago)
- Last Synced: 2024-11-03T23:19:49.911Z (5 months ago)
- Topics: graphql, graphql-koa-scripts, koa2, nodejs
- Language: JavaScript
- Homepage: https://ryanhs.github.io/graphql-koa-scripts/
- Size: 517 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-graphql - graphql-koa-scripts - GraphQL Koa 1 file simplified. usefull for quick test (Implementations / JavaScript/TypeScript)
README
# Graphql Koa Scripts
  [](https://travis-ci.com/ryanhs/graphql-koa-scripts) [](https://coveralls.io/github/ryanhs/graphql-koa-scripts?branch=master)
Documentation: [https://ryanhs.github.io/graphql-koa-scripts/](https://ryanhs.github.io/graphql-koa-scripts/)
## Motivation
This scripts made to be simplify the setup of projects. with koa + apollo graphql.
I really want to make a project setup as simple as possible:
- `index.js`,
- `package.json`,
- `Dockerfile` (optional when needed)Thats it! no more overhead setup.
## Example index.js
With this enough `index.js`, graphql already setup. This what simple is?
*Notes: if you use subscription on your graphql, it will automatically listen subscription-ws.*
```javascript
const { Server } = require('graphql-koa-scripts');Server({
configure: () => ({ PORT: 14099 }),router(_, { graphqlHandler }) {
graphqlHandler({
typeDefs: `
type Query {
hello: String
}
`,
resolvers: {
Query: {
hello: () => 'Awesome!',
},
},
endpointUrl: '/graphql',
});
},
})
```## Installation
To install just use `yarn` or `npm`. Example:
```sh
yarn add graphql-koa-scripts
```## [Examples](https://ryanhs.github.io/graphql-koa-scripts/#/examples)
## [API References](https://ryanhs.github.io/graphql-koa-scripts/#/API)
## LICENSE
MIT