forked from spring-projects/spring-graphql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Drop existing single page cdn integration from boot project. - Create new spring-graphql-graphiql module containing graphiql integration. - Makes graphiql optional which user can pull in as a dependency. - spring-graphql-graphiql is a basic npm module which packages itself as a jar where boot autoconfig can integrate to. - In a npm module graphiql itself is handled as a plain react app which allows some customisation like setting logo name to demonstrate how things are passed from boot properties into a react app itself. - GraphiQlHandler's are changed to handle all traffic into `/graphiql` order to: - Handling main html in `/graphiql/explorer` - Redirect to `/graphiql/explorer` to get context path under `/graphiql/` - Handle `main.js` from classpath to get html to load it under `/graphiql/` - Handle `config.js` as a way to pass configuration options from server side and load those into react app which is based on long discussion in facebook/create-react-app#2353 to overcome issues not hardcoding things on a compile time. - Samples webmvc-http and webflux-websocket is changed to use this module. - webmvc-http is as it used to be. - webflux-websocket can now use subcription which gets first greeting instead of subscribtion request reply. This is a draft POC, so tests and more work to npm project would be added later to polish things a bit. Bundle via webpack is way too big right now and didn't yet figure out why tree shaking don't work better. This is a based on some of my old hacks I experimented with graphiql and if looking promising would then give better foundation to think about security and other things we'd like to have on this layer. Having a full blown module and react code in typescript makes it easier to tweak things instead of trying to rely on public stuff on cdn as a static app relying on an internet access. With `webmvc-http` you can use: ``` query { greeting } ``` With `webflux-websocket` you can use both: ``` query { greeting } subscription { greetings } ```
- Loading branch information
Showing
20 changed files
with
8,568 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 0 additions & 96 deletions
96
graphql-spring-boot-starter/src/main/resources/graphiql/index.html
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
build | ||
dist | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"printWidth": 80, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"bracketSpacing": false, | ||
"arrowParens": "avoid", | ||
"parser": "typescript" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
sourceMaps: true, | ||
presets: [ | ||
require.resolve('@babel/preset-env'), | ||
require.resolve('@babel/preset-react'), | ||
require.resolve('@babel/preset-typescript'), | ||
], | ||
plugins: [ | ||
require.resolve('@babel/plugin-proposal-class-properties'), | ||
// require.resolve('@babel/plugin-transform-runtime') | ||
// [require.resolve('@babel/plugin-transform-runtime'), {"regenerator": true}] | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
plugins { | ||
id 'java-library' | ||
id "com.github.node-gradle.node" version "2.2.0" | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
node { | ||
version = '10.16.3' | ||
npmVersion = '6.9.0' | ||
download = true | ||
} | ||
|
||
jar.dependsOn 'npm_run_mavenbuild' | ||
|
||
jar { | ||
from 'dist' into 'graphiql' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" dir="ltr"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> | ||
<title>Spring GraphQL Explorer</title> | ||
<script src="config.js"></script> | ||
</head> | ||
|
||
<body> | ||
<style> | ||
body { | ||
padding: 0; | ||
margin: 0; | ||
min-height: 100vh; | ||
} | ||
#root { | ||
height: 100vh; | ||
} | ||
</style> | ||
<div id="root"></div> | ||
</body> | ||
</html> |
Oops, something went wrong.