Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

ryanhs/graphql-koa-scripts

Open more actions menu

Repository files navigation

Graphql Koa Scripts

npm node-current Build Status Coverage Status

Documentation: 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.

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:

yarn add graphql-koa-scripts

LICENSE

MIT

About

Apollo Graphql + Koa, just a simplified setup

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.