GithubHelp home page GithubHelp logo

ctco / nodejs-graphql-template Goto Github PK

View Code? Open in Web Editor NEW
14.0 11.0 3.0 590 KB

Template project for Node.js® GraphQL APIs

License: MIT License

TypeScript 89.02% JavaScript 6.72% Dockerfile 4.25%
koa graphql typescript jest nock template nodejs graphql-voyager docker apollo-server graphql-tools graphql-playground yarn

nodejs-graphql-template's Introduction

Maintenance PRs Welcome Build Status TravisCI Build Status AppVeyor dependencies Status devDependencies Status

nodejs-graphql-template

Node.js, Koa, GraphQL and TypeScript template project.

Batteries and opinions included 🙌

Features

  • Docker 🐳 configuration for production deployment, development and testing

  • GraphQL tools:

    • GraphiQL
    • GraphQL Voyager
    • GraphQL Playground
    • GraphQL IDL
    • Apollo Tracing
  • Reference GraphQL Models and Connectors architecture implementation

  • CORS middleware

  • 12 Factor Configuration with .env

  • Configurable logging

    • powered by winston
  • Supercharged Development Mode

    • Incremental TypeScript builds
    • Automatic server restart on changes
    • Linting
  • Testing

    • Unit tests
    • Integration tests for GraphQL schema
  • Reporting

    • Test result export to JUnit format
    • Coverage result export to Cobertura format

Required Software

  • node >= 8.1.4 & yarn

or

  • Docker >= 17.05

Install

  • yarn: $ yarn
  • Docker: $ docker-compose up

Develop

  • yarn: $ yarn start
  • Docker: $ docker-compose up --build

Attention Windows users: when Docker for Windows is not an option, install yarn and run $ yarn && yarn docker-mount beforehand.

Generate TypeScript types for GraphQL schema and default GraphQL resolvers

$ yarn gqlgen

Test

single test run

Run unit tests

$ yarn test:unit

Run integration tests

$ yarn test:integration

Run all tests

$ yarn test

Run e2e tests

Run the app or point E2E_TEST_URL to a remote instance you want to test against.

$ yarn test:e2e

Generate coverage reports

Set environment variable CI to true to generate coverage reports.

In *nix:

CI=true yarn test

In Windows:

set CI=true&&yarn test

Build

$ yarn build or $ docker build .

Tech Stack

nodejs-graphql-template's People

Contributors

aeldar avatar alexbal7 avatar greenkeeper[bot] avatar jelisejev avatar trioletas avatar zed3v avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodejs-graphql-template's Issues

Running integration tests without a required variable causes them to fail without a clear error message

Error example

C:\devtools\idea2016.3.1\bin\runnerw.exe C:\tools\node\node.exe C:\tools\node\node_modules\npm\bin\npm-cli.js run test:integration

> [email protected] test:integration C:\project\project-name
> jest --projects src/graphql

module.js:472
    throw err;
    ^

Error: Cannot find module 'C:\project\project-name\node_modules\jest-cli'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at getJest (C:\project\project-name\node_modules\jest\node_modules\jest-cli\build\cli\getJest.js:22:12)
    at Object.run (C:\project\project-name\node_modules\jest\node_modules\jest-cli\build\cli\index.js:39:48)
    at Object.<anonymous> (C:\project\project-name\node_modules\jest\node_modules\jest-cli\bin\jest.js:14:25)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test:integration: `jest --projects src/graphql`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] test:integration script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\pavel.yeliseev\AppData\Roaming\npm-cache\_logs\2017-06-02T12_33_02_399Z-debug.log

Process finished with exit code 1

GraphQL Query Tracing

Capture and log query information: query, operation name, query variables. Check if existing middleware can do that!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.