@aleleba/create-node-ts-graphql-server 1.0.5 → 1.0.8
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/.env.example +2 -0
- package/bin/cli.js +1 -1
- package/config/index.ts +1 -0
- package/package.json +6 -5
- package/src/index.ts +5 -1
package/.env.example
CHANGED
package/bin/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ const runCommand = command => {
|
|
|
13
13
|
|
|
14
14
|
const repoName = process.argv[2];
|
|
15
15
|
const gitCheckoutCommand = `git clone --depth 1 https://github.com/aleleba/create-node-ts-graphql-server ${repoName}`;
|
|
16
|
-
const installDepsCommand = `cd ${repoName} && npm install`;
|
|
16
|
+
const installDepsCommand = `cd ${repoName} && rm -rf .git && git init && git add . && git commit -m "Initial commit" && npm install`;
|
|
17
17
|
|
|
18
18
|
console.log(`Cloning the repository with name ${repoName}`);
|
|
19
19
|
const checkedOut = runCommand(gitCheckoutCommand);
|
package/config/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ dotenv.config();
|
|
|
5
5
|
export const config = {
|
|
6
6
|
env: process.env.ENVIRONMENT ? process.env.ENVIRONMENT : 'production',
|
|
7
7
|
graphiQL: process.env.GRAPHIQL === 'true' ? true : false,
|
|
8
|
+
playgroundGraphQL: process.env.PLAYGROUND_GRAPHQL === 'true' ? true : false,
|
|
8
9
|
whiteList: process.env.WHITELIST_URLS ? process.env.WHITELIST_URLS.split(',') : [
|
|
9
10
|
'http://localhost'
|
|
10
11
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aleleba/create-node-ts-graphql-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Node with Typescript and GraphQL Server",
|
|
5
5
|
"bin": "./bin/cli.js",
|
|
6
6
|
"main": "index.js",
|
|
@@ -40,11 +40,12 @@
|
|
|
40
40
|
"express": "^4.18.1",
|
|
41
41
|
"express-graphql": "^0.12.0",
|
|
42
42
|
"graphql": "^16.5.0",
|
|
43
|
+
"graphql-playground-middleware-express": "^1.7.23",
|
|
43
44
|
"graphql-subscriptions": "^2.0.0",
|
|
44
45
|
"graphql-tools": "^8.2.11",
|
|
45
46
|
"graphql-ws": "^5.8.2",
|
|
46
47
|
"web-push": "^3.5.0",
|
|
47
|
-
"ws": "^8.
|
|
48
|
+
"ws": "^8.7.0"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
51
|
"@babel/core": "^7.18.2",
|
|
@@ -52,11 +53,11 @@
|
|
|
52
53
|
"@babel/preset-typescript": "^7.17.12",
|
|
53
54
|
"@babel/register": "^7.17.7",
|
|
54
55
|
"@types/jest": "^27.5.1",
|
|
55
|
-
"@types/node": "^17.0.
|
|
56
|
+
"@types/node": "^17.0.36",
|
|
56
57
|
"@types/webpack": "^5.28.0",
|
|
57
58
|
"@types/webpack-node-externals": "^2.5.3",
|
|
58
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
59
|
-
"@typescript-eslint/parser": "^5.
|
|
59
|
+
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
|
60
|
+
"@typescript-eslint/parser": "^5.27.0",
|
|
60
61
|
"babel-loader": "^8.2.5",
|
|
61
62
|
"clean-webpack-plugin": "^4.0.0",
|
|
62
63
|
"compression-webpack-plugin": "^10.0.0",
|
package/src/index.ts
CHANGED
|
@@ -7,11 +7,11 @@ import cookieParser from 'cookie-parser';
|
|
|
7
7
|
import { useServer } from 'graphql-ws/lib/use/ws';
|
|
8
8
|
import { execute, subscribe } from 'graphql';
|
|
9
9
|
import GraphQLserver from './GraphQL/server';// Server of GraphQL,
|
|
10
|
+
import expressPlayground from 'graphql-playground-middleware-express';
|
|
10
11
|
import schema from './GraphQL/schema';
|
|
11
12
|
import { config } from '../config';
|
|
12
13
|
import apiRouter from './routes';
|
|
13
14
|
|
|
14
|
-
|
|
15
15
|
const app = express(), //creating app
|
|
16
16
|
whitelist = config.whiteList,
|
|
17
17
|
corsOptions = {
|
|
@@ -34,6 +34,10 @@ app
|
|
|
34
34
|
.use(apiRouter)//Routes de App
|
|
35
35
|
.use('/graphql', GraphQLserver);//Server of Graphql
|
|
36
36
|
|
|
37
|
+
if(config.playgroundGraphQL === true){
|
|
38
|
+
app.get('/playground', expressPlayground({ endpoint: '/graphql' }));
|
|
39
|
+
}
|
|
40
|
+
|
|
37
41
|
// DO NOT DO app.listen() unless we're testing this directly
|
|
38
42
|
if (require.main === module) {
|
|
39
43
|
|