mirror of
https://github.com/aleleba/create-node-ts-graphql-server.git
synced 2026-06-04 07:34:26 -06:00
PR-594489: Updating packages and changing playground.
This commit is contained in:
6
src/@types/custom.d.ts
vendored
6
src/@types/custom.d.ts
vendored
@@ -11,4 +11,8 @@ declare module 'cookie-parse' {
|
||||
|
||||
declare module 'graphql-ws/use/ws' {
|
||||
export * from 'graphql-ws/dist/use/ws';
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'ruru/server' {
|
||||
export * from 'ruru/dist/server';
|
||||
}
|
||||
|
||||
15
src/index.ts
15
src/index.ts
@@ -8,7 +8,7 @@ import cookieParser from 'cookie-parser';
|
||||
import { useServer } from 'graphql-ws/use/ws';
|
||||
import { execute, subscribe } from 'graphql';
|
||||
import GraphQLserver from '@GraphQL/server';// Server of GraphQL,
|
||||
import expressPlayground from 'graphql-playground-middleware-express';
|
||||
import { ruruHTML } from 'ruru/server';
|
||||
import schema from '@GraphQL/schema';
|
||||
import { config } from '@config';
|
||||
import apiRouter from '@routes';
|
||||
@@ -36,13 +36,12 @@ app
|
||||
.use('/graphql', GraphQLserver);//Server of Graphql
|
||||
|
||||
if(config.PLAYGROUND_GRAPHQL === true){
|
||||
app.get('/playground', expressPlayground({
|
||||
endpoint: '/graphql',
|
||||
subscriptionEndpoint: '/graphql',
|
||||
settings: {
|
||||
'request.credentials': 'include', //Include Credentials for playground
|
||||
},
|
||||
}));
|
||||
app.get('/playground', (_req, res) => {
|
||||
res.type('html');
|
||||
res.end(ruruHTML({
|
||||
endpoint: '/graphql',
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
// DO NOT DO app.listen() unless we're testing this directly
|
||||
|
||||
Reference in New Issue
Block a user