@lenne.tech/nest-server 3.4.0 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.env.js +1 -0
- package/dist/config.env.js.map +1 -1
- package/dist/core/common/interfaces/server-options.interface.d.ts +1 -0
- package/dist/main.js +5 -0
- package/dist/main.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/config.env.ts +1 -0
- package/src/core/common/interfaces/server-options.interface.ts +13 -0
- package/src/main.ts +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/nest-server",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"description": "Modern, fast, powerful Node.js web framework in TypeScript based on Nest with a GraphQL API and a connection to MongoDB (or other databases).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
"fastify": "3.27.1",
|
|
87
87
|
"graphql": "16.3.0",
|
|
88
88
|
"graphql-subscriptions": "2.0.0",
|
|
89
|
+
"graphql-voyager": "1.0.0-rc.31",
|
|
89
90
|
"grunt": "1.4.1",
|
|
90
91
|
"grunt-bg-shell": "2.3.3",
|
|
91
92
|
"grunt-contrib-clean": "2.0.0",
|
package/src/config.env.ts
CHANGED
|
@@ -21,8 +21,21 @@ export interface IServerOptions {
|
|
|
21
21
|
* and https://www.apollographql.com/docs/apollo-server/api/apollo-server/
|
|
22
22
|
*/
|
|
23
23
|
graphQl?: {
|
|
24
|
+
/**
|
|
25
|
+
* Driver configuration for Apollo
|
|
26
|
+
*/
|
|
24
27
|
driver?: ApolloDriverConfig;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Subscription authentication
|
|
31
|
+
*/
|
|
25
32
|
enableSubscriptionAuth?: boolean;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Enable GraphQL Voyager
|
|
36
|
+
* https://github.com/APIs-guru/graphql-voyager
|
|
37
|
+
*/
|
|
38
|
+
voyager?: boolean;
|
|
26
39
|
};
|
|
27
40
|
|
|
28
41
|
/**
|
package/src/main.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { NestFactory } from '@nestjs/core';
|
|
|
2
2
|
import { NestExpressApplication } from '@nestjs/platform-express';
|
|
3
3
|
import envConfig from './config.env';
|
|
4
4
|
import { ServerModule } from './server/server.module';
|
|
5
|
+
import { express as voyagerMiddleware } from 'graphql-voyager/middleware';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Preparations for server start
|
|
@@ -23,6 +24,11 @@ async function bootstrap() {
|
|
|
23
24
|
// Enable cors to allow requests from other domains
|
|
24
25
|
server.enableCors();
|
|
25
26
|
|
|
27
|
+
// Activate GraphQL Voyager
|
|
28
|
+
if (envConfig.graphQl?.voyager) {
|
|
29
|
+
server.use('/voyager', voyagerMiddleware({ endpointUrl: '/graphql' }));
|
|
30
|
+
}
|
|
31
|
+
|
|
26
32
|
// Start server on configured port
|
|
27
33
|
await server.listen(envConfig.port);
|
|
28
34
|
}
|