18.1.0 • Published 6 months ago

@whook/graphiql v18.1.0

Weekly downloads
284
License
MIT
Repository
github
Last release
6 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

18.1.0

6 months ago

18.0.3

6 months ago

18.0.0

6 months ago

17.0.2

8 months ago

17.0.1

11 months ago

17.0.0

11 months ago

16.1.1

1 year ago

16.1.0

1 year ago

16.0.1

1 year ago

16.0.0

1 year ago

15.0.0

1 year ago

13.1.0

2 years ago

13.2.0

2 years ago

14.0.0

2 years ago

13.2.1

2 years ago

13.0.0

2 years ago

10.0.5

3 years ago

10.0.6

3 years ago

10.0.0

3 years ago

10.0.1

3 years ago

10.0.2

3 years ago

10.0.3

3 years ago

10.0.4

3 years ago

12.0.0

2 years ago

12.0.1

2 years ago

12.0.2

2 years ago

11.0.0

3 years ago

11.0.1

3 years ago

9.0.1

3 years ago

9.0.0

3 years ago

8.5.1

4 years ago

8.5.0

4 years ago

8.4.2

4 years ago

8.4.1

4 years ago

8.4.0

4 years ago

8.3.0

4 years ago

8.1.0

4 years ago

8.1.1

4 years ago

8.0.4

4 years ago

8.0.3

4 years ago

8.0.1

4 years ago

8.0.0

4 years ago

8.0.2

4 years ago

7.1.5

4 years ago

7.1.4

4 years ago

7.1.3

4 years ago

7.1.1

4 years ago

7.1.0

4 years ago

7.0.0

4 years ago

6.0.0

5 years ago

5.1.6

5 years ago

5.1.5

5 years ago

5.1.4

5 years ago

5.1.3

5 years ago

5.1.2

5 years ago

5.1.1

5 years ago

5.1.0

5 years ago

5.0.0

5 years ago

4.1.1

5 years ago

4.1.0

5 years ago

4.0.4

5 years ago

4.0.2

5 years ago

4.0.1

5 years ago

4.0.0

5 years ago

4.0.0-alpha.44

5 years ago

4.0.0-alpha.43

5 years ago

4.0.0-alpha.42

5 years ago

4.0.0-alpha.41

5 years ago

4.0.0-alpha.40

5 years ago

4.0.0-alpha.39

5 years ago

4.0.0-alpha.38

5 years ago

4.0.0-alpha.37

5 years ago

4.0.0-alpha.36

5 years ago