16.1.0 • Published 2 months ago

@whook/graphiql v16.1.0

Weekly downloads
284
License
MIT
Repository
github
Last release
2 months ago

@whook/graphiql

A wrapper for the Whook HTTP Router to provide GraphIQL for local dev

GitHub license

This module provides the GraphIQL UI to your local Whook server !

Usage

The DEV_MODE=1 environment variable must be used when starting your server (the npm run dev script of default Whook projects does it by default).

Setup

Install the module:

npm i @whook/graphiql

Update the types (usually in src/whook.d.ts):

+import type {
+   WhookGraphIQLEnv,
+   WhookGraphIQLConfig,
+} from '@whook/graphiql';

// ...

declare module 'application-services' {

  export interface AppEnvVars
    extends BaseAppEnvVars,
      WhookBaseEnv,
      // (...)
+      WhookGraphIQLEnv,
      WhookSwaggerUIEnv {}

  // (...)

  export interface AppConfig
    extends WhookBaseConfigs,
      // (...)
+      WhookGraphIQLConfig,
      JWTServiceConfig {}

  // ...

}

Then, just wrap the HTTP router with this module and register it again with the Knifecycle instance inside the runServer function (usually in src/index.ts):

+ import initHTTPRouter from '@whook/http-router';
+ import wrapHTTPRouterWithGraphIQL from '@whook/graphiql';

// (...)

// It is important to do this in the runServer function since it really
//  make sense only when actually running the server
export async function runServer(injectedNames = [], $ = new Knifecycle()) {

  // (...)

+  // Add support for GraphIQL UI by wrapping and
+  //  overriding the original HTTP Router
+  $.register(
+    wrapHTTPRouterWithGraphIQL(initHTTPRouter),
+  );

  return await runBaseServer(injectedNames, $);
}

API

Authors

License

MIT

16.1.0

2 months ago

16.0.1

2 months ago

16.0.0

2 months ago

15.0.0

3 months ago

13.1.0

9 months ago

13.2.0

7 months ago

14.0.0

6 months ago

13.2.1

7 months ago

13.0.0

9 months ago

10.0.5

2 years ago

10.0.6

2 years ago

10.0.0

2 years ago

10.0.1

2 years ago

10.0.2

2 years ago

10.0.3

2 years ago

10.0.4

2 years ago

12.0.0

1 year ago

12.0.1

1 year ago

12.0.2

1 year ago

11.0.0

1 year ago

11.0.1

1 year ago

9.0.1

2 years ago

9.0.0

2 years ago

8.5.1

3 years ago

8.5.0

3 years ago

8.4.2

3 years ago

8.4.1

3 years ago

8.4.0

3 years ago

8.3.0

3 years ago

8.1.0

3 years ago

8.1.1

3 years ago

8.0.4

3 years ago

8.0.3

3 years ago

8.0.1

3 years ago

8.0.0

3 years ago

8.0.2

3 years ago

7.1.5

3 years ago

7.1.4

3 years ago

7.1.3

3 years ago

7.1.1

3 years ago

7.1.0

3 years ago

7.0.0

3 years ago

6.0.0

3 years ago

5.1.6

4 years ago

5.1.5

4 years ago

5.1.4

4 years ago

5.1.3

4 years ago

5.1.2

4 years ago

5.1.1

4 years ago

5.1.0

4 years ago

5.0.0

4 years ago

4.1.1

4 years ago

4.1.0

4 years ago

4.0.4

4 years ago

4.0.2

4 years ago

4.0.1

4 years ago

4.0.0

4 years ago

4.0.0-alpha.44

4 years ago

4.0.0-alpha.43

4 years ago

4.0.0-alpha.42

4 years ago

4.0.0-alpha.41

4 years ago

4.0.0-alpha.40

4 years ago

4.0.0-alpha.39

4 years ago

4.0.0-alpha.38

4 years ago

4.0.0-alpha.37

4 years ago

4.0.0-alpha.36

4 years ago