Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 2 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 (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-07-26T23:07:46.000Z (about 2 months ago)
- Last Synced: 2024-07-27T00:24:14.648Z (about 2 months ago)
- Topics: graphql, graphql-koa-scripts, koa2, nodejs
- Language: JavaScript
- Homepage: https://ryanhs.github.io/graphql-koa-scripts/
- Size: 515 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
![npm](https://img.shields.io/npm/v/graphql-koa-scripts) ![node-current](https://img.shields.io/node/v/graphql-koa-scripts) [![Build Status](https://travis-ci.com/ryanhs/graphql-koa-scripts.svg?branch=master)](https://travis-ci.com/ryanhs/graphql-koa-scripts) [![Coverage Status](https://coveralls.io/repos/github/ryanhs/graphql-koa-scripts/badge.svg?branch=master)](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