Code Monkey home page Code Monkey logo

graphql-toolbox's Introduction

GraphQL Toolbox

A set of GraphQL tools to help with GraphQL server and client development.

Getting Started

The prerequisites are SBT, Java 8, npm.

In order to run the server locally you need to execute following commands:

$ npm install
$ sbt run

This will run the Play app in a dev mode which means that it will pick up all of the changes to a source code (this also includes resources managed by webpack).

graphql-toolbox's People

Contributors

olegilyenko avatar tlvenn avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

graphql-toolbox's Issues

Provide bootstrap graphiql entry point

Right now, GraphiQL is completely self configured and bootstrapped which works great for Sangria purpose but kinda limit how it can be used outside of it.

It would be nice to introduce a bootstrapGraphiQL function that can be called from the html template. Such function should take the defaultUrl param and be passed to AppConfig.

Additionally, it would be nice to support the following optional params to configure the first tab if there is no previous state:

  • query
  • variables
  • response

Abbreviate headers

This is graphiql related, hope it's still the right repo for it.

When you have a very long header, it pushes out the controls next to it, making them hard to reach (you can't actually I had to inspect the source and delete the labels contents):

bug-headers

I think it would be nice to abbreviate the headers text to a reasonable size (like 50 chars or so) to avoid this problem

Weird introspection query

When I just load graphiql interface (same behaviour in incognito mode), it immediately sends introspection query:

image

For input query as follows:

query($name: String!) {
  nameResolver(names: [$name]) {
    total
  }
}

variables:
{
  "name": "Ctenidium molluscum var. compactum"
}

it sends query, and then in second that introspection query, that actually overlaps the result.

Using the toolbox

Hi there,

I have a node express GraphQL server. So far I've been enabling GraphiQL directly in the express web server. I'd like to add header based authentication to my GraphQL server. That's easy enough, and I've done that, but it introduces a problem for my web IDE experience. GraphiQL doesn't natively provide a way to add headers to requests.

I thought graphql-toolbox might be a good solution for me. I noticed that graphql-toolbox allows users to provider custom headers. If I can point a graphql-toolbox server at my graphql endpoint, I will be in business.

This doesn't seem to work for me, though. I updated the defaultUrl to point to my internal graphQL server.

defaultUrl: "https://castle.ezesoftcloud.com/api/referencedata/v2/graphql",

Then I stood up a GraphQL Toolbox server with this config.

GraphQL Toolbox starts with this default URL, but it hangs loading the documentation (I guess it's trying to do introspection queries and failing).

Is my use case something that the graphql-toolbox is intended to facilitate? If so, any ideas what I'm doing wrong?

Thanks!

Publish advanced graphiql to jsdelivr

Hi,

Great work on improving on top of GraphiQL !

I was wondering if you could publish your advanced version of GraphiQL to cdnjs (similarly to how the original GraphiQL app is published there already) so that other projects could easily embed and serve it ?

Thanks a lot in advance.

Failed when launch locally

Hi,

Having

$ system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: macOS 10.12.2 (16C67)
      Kernel Version: Darwin 16.3.0
$ npm -v
4.3.0
$ sbt sbtVersion
[info] 0.13.11

I have error as follows:

sbt run     
[info] Loading global plugins from /Users/user/.sbt/0.13/plugins
[info] Loading project definition from /Users/user/projects/project/tmp/graphql-toolbox/project
[info] Set current project to graphql-toolbox (in build file:/Users/user/projects/project/tmp/graphql-toolbox/)

--- (Running the application, auto-reloading is enabled) ---

[info] p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

(Server started, use Ctrl+D to stop and go back to the console...)

Hash: 26a367041ad92332d98f
Version: webpack 1.12.13
Time: 19195ms
           Asset      Size  Chunks             Chunk Names
   format.js.map   4.02 MB       0  [emitted]  format
       format.js   3.36 MB       0  [emitted]  format
        index.js    345 kB       2  [emitted]  index
        proxy.js   3.73 MB       3  [emitted]  proxy
      format.css   37.9 kB       0  [emitted]  format
    graphiql.css   32.8 kB       1  [emitted]  graphiql
       index.css    106 kB       2  [emitted]  index
       proxy.css   40.1 kB       3  [emitted]  proxy
     graphiql.js   3.67 MB       1  [emitted]  graphiql
  format.css.map  87 bytes       0  [emitted]  format
 graphiql.js.map   4.41 MB       1  [emitted]  graphiql
graphiql.css.map  89 bytes       1  [emitted]  graphiql
    index.js.map    432 kB       2  [emitted]  index
   index.css.map  86 bytes       2  [emitted]  index
    proxy.js.map   4.46 MB       3  [emitted]  proxy
   proxy.css.map  86 bytes       3  [emitted]  proxy
   [0] multi format 40 bytes {0} [built]
   [0] multi graphiql 52 bytes {1} [built]
   [0] multi index 40 bytes {2} [built]
   [0] multi proxy 52 bytes {3} [built]
    + 661 hidden modules

ERROR in ./~/extract-text-webpack-plugin/loader.js?{"omit":1,"extract":true,"remove":true}!./~/style-loader!./~/css-loader!./~/resolve-url-loader!./~/sass-loader?sourceMap!./~/bootstrap-loader/lib/bootstrap.styles.loader.js?{"bootstrapVersion":3,"useCustomIconFontPath":false,"extractStyles":true,"styleLoaders":["style","css","sass"],"styles":["mixins","normalize","print","glyphicons","scaffolding","type","code","grid","tables","forms","buttons","component-animations","dropdowns","button-groups","input-groups","navs","navbar","breadcrumbs","pagination","pager","labels","badges","jumbotron","thumbnails","alerts","progress-bars","media","list-group","panels","wells","responsive-embed","close","modals","tooltip","popovers","carousel","utilities","responsive-utilities"],"scripts":["transition","alert","button","carousel","collapse","dropdown","modal","tooltip","popover","scrollspy","tab","affix"],"configFilePath":"/Users/user/projects/project/tmp/graphql-toolbox/~/bootstrap-loader/.bootstraprc-3-default","bootstrapPath":"/Users/ycomb/projects/project/tmp/graphql-toolbox/~/bootstrap-sass","bootstrapRelPath":"../bootstrap-sass"}!./~/bootstrap-loader/no-op.js
Module build failed: Error: ENOENT: no such file or directory, scandir '/Users/user/projects/project/tmp/graphql-toolbox/node_modules/node-sass/vendor'
    at Object.fs.readdirSync (fs.js:870:18)
    at Object.getInstalledBinaries (/Users/user/projects/project/tmp/graphql-toolbox/node_modules/node-sass/lib/extensions.js:121:13)
    at foundBinariesList (/Users/user/projects/project/tmp/graphql-toolbox/node_modules/node-sass/lib/errors.js:20:15)
    at foundBinaries (/Users/user/projects/project/tmp/graphql-toolbox/node_modules/node-sass/lib/errors.js:15:5)
    at Object.module.exports.missingBinary (/Users/user/projects/project/tmp/graphql-toolbox/node_modules/node-sass/lib/errors.js:45:5)
    at module.exports (/Users/user/projects/project/tmp/graphql-toolbox/node_modules/node-sass/lib/binding.js:15:30)
    at Object.<anonymous> (/Users/user/projects/project/tmp/graphql-toolbox/node_modules/node-sass/lib/index.js:14:35)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/user/projects/project/tmp/graphql-toolbox/node_modules/sass-loader/index.js:4:12)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at NormalModule.loadPitch (/Users/user/projects/project/tmp/graphql-toolbox/node_modules/webpack-core/lib/NormalModuleMixin.js:193:17)
    at NormalModule.loadPitch (/Users/user/projects/project/tmp/graphql-toolbox/node_modules/webpack-core/lib/NormalModuleMixin.js:186:21)
    at NormalModule.loadPitch (/Users/user/projects/project/tmp/graphql-toolbox/node_modules/webpack-core/lib/NormalModuleMixin.js:223:61)
    at NormalModule.loadPitch (/Users/user/projects/project/tmp/graphql-toolbox/node_modules/webpack-core/lib/NormalModuleMixin.js:186:21)
    at NormalModule.loadPitch (/Users/user/projects/project/tmp/graphql-toolbox/node_modules/webpack-core/lib/NormalModuleMixin.js:223:61)
    at NormalModule.doBuild (/Users/user/projects/project/tmp/graphql-toolbox/node_modules/webpack-core/lib/NormalModuleMixin.js:241:4)
    at NormalModule.build (/Users/user/projects/project/tmp/graphql-toolbox/node_modules/webpack/lib/NormalModule.js:84:14)
    at Compilation.buildModule (/Users/user/projects/project/tmp/graphql-toolbox/node_modules/webpack/lib/Compilation.js:126:9)
 @ ./~/bootstrap-loader/lib/bootstrap.loader.js?extractStyles!./~/bootstrap-loader/no-op.js 1:21-1353
Child extract-text-webpack-plugin:
        + 1 hidden modules
    
    ERROR in ENOENT: no such file or directory, scandir '/Users/user/projects/project/tmp/graphql-toolbox/node_modules/node-sass/vendor'
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules

And Javascript console claims at http://localhost:9000/graphiql

Uncaught Error: Cannot find module "/Users/user/projects/project/tmp/graphql-toolbox/node_modules/extract-text-webpack-plugin/loader.js?{"omit":1,"extract":true,"remove":true}!style!css!resolve-url!sass?sourceMap!./lib/bootstrap.styles.loader.js?{"bootstrapVersion":3,"useCustomIconFontPath":false,"extractStyles":true,"styleLoaders":["style","css","sass"],"styles":["mixins","normalize","print","glyphicons","scaffolding","type","code","grid","tables","forms","buttons","component-animations","dropdowns","button-groups","input-groups","navs","navbar","breadcrumbs","pagination","pager","labels","badges","jumbotron","thumbnails","alerts","progress-bars","media","list-group","panels","wells","responsive-embed","close","modals","tooltip","popovers","carousel","utilities","responsive-utilities"],"scripts":["transition","alert","button","carousel","collapse","dropdown","modal","tooltip","popover","scrollspy","tab","affix"],"configFilePath":"/Users/ycomb/projects/project/tmp/graphql-toolbox/node_modules/bootstrap-loader/.bootstraprc-3-default","bootstrapPath":"/Users/ycomb/projects/project/tmp/graphql-toolbox/node_modules/bootstrap-sass","bootstrapRelPath":"../bootstrap-sass"}!./no-op.js"
    at webpackMissingModule (no-op.js:1)
    at Object.<anonymous> (no-op.js:1)
    at __webpack_require__ (bootstrap 26a3670…?112a:19)
    at Object.<anonymous> (extractStyles.js:1)
    at __webpack_require__ (bootstrap 26a3670…?112a:19)
    at Object.<anonymous> (bootstrap 26a3670…?112a:39)
    at __webpack_require__ (bootstrap 26a3670…?112a:19)
    at bootstrap 26a3670…?112a:39
    at bootstrap 26a3670…?112a:39

How to fix that?

Schema-stitching

Not sure whether this would belong here or in the main Sangria repo, but the question is if there are plans to bring schema-stitching functionality? Would really help integrating different backends as they move from REST to GraphQL

Release as (possibly multiple) npm module(s)

To me it seems, like most of the features of toolbox are not strictly tied to scala/sbt and could be released as npm modules individually. What I'm thinking about is basically separating the js features listed on the toolbox page, and pull them in individually in this repo:

  • Enhanced GraphiQL - I think this would be the most crucial part to release separately. This contains features that most people who start using GraphQL need (regardless of the backend implementation) but most likely will never make it to the official GraphiQL repo considering the attitude there to keep the repo as small and protocol independent as possible. Separating this (probably putting it into its own repo under a more discoverable name) would probably (drastically) increase it's usage and popularity among node users, since looking at the issues in the GraphiQL repo, everybody comes up with half baked solutions to enable headers, tabs, etc. For me it was pure luck finding it on the second or third google page (searching for the mentioned features) being mentioned in one of @OlegIlyenko s twitter post, and oh boy am I happy I did find it. It would also make it much easier to expose the module on a cdn - #3 - using a prepublish hook or the likes.
  • Formatter - didn't really spend time figuring out if it's another js component doing the heavy lifting in terms of formatting, or a scala component exposed through an http endpoint. If it's the former, it would also fit nicely as a standalone npm module.
  • Proxy - honestly I have no idea what this does, since I didn't have any use for it yet. But again, if it's something that is implemented on the js side, then with a bit more explanation of the feature it could be it's separate module.

Now this doesn't mean splitting toolbox into multiple repos, if a mono-repo is preferred, lerna can help out in this field.

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.