Skip to content

Commit 6872fe3

Browse files
committed
Use graphql-yoga instead of graphql-server-express
1 parent 70fab1d commit 6872fe3

File tree

3 files changed

+8
-60
lines changed

3 files changed

+8
-60
lines changed

package.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"@arangodb": false
2727
},
2828
"devDependencies": {
29-
"@types/body-parser": "^1.16.3",
3029
"@types/colors": "^1.1.3",
3130
"@types/cors": "^2.8.1",
3231
"@types/graphql": "~0.11.5",
@@ -39,13 +38,9 @@
3938
"@types/pluralize": "0.0.27",
4039
"@types/strip-json-comments": "0.0.30",
4140
"@types/uuid": "^3.4.2",
42-
"body-parser": "^1.17.2",
43-
"cors": "^2.8.3",
4441
"dependency-check": "^2.9.1",
45-
"express": "~4.15.4",
4642
"graphql": "~0.11.7",
47-
"graphql-server-core": "~1.1.0",
48-
"graphql-server-express": "^1.1.2",
43+
"graphql-yoga": "^1.4.3",
4944
"jasmine": "^2.5.3",
5045
"jasmine-console-reporter": "^2.0.1",
5146
"jasmine-promises": "^0.4.1",

spec/dev/graphql-server.ts

-50
This file was deleted.

spec/dev/server.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { ArangoDBAdapter } from '../..';
2-
import { GraphQLServer } from './graphql-server';
32
import { globalContext } from '../../src/config/global';
43
import * as path from 'path';
54
import { loadProjectFromDir } from '../../src/project/project-from-fs';
6-
import { InMemoryAdapter } from '../../src/database/inmemory/inmemory-adapter';
5+
import { InMemoryAdapter } from '../../src/database/inmemory';
6+
import { GraphQLServer } from 'graphql-yoga';
77

88
const port = 3000;
99
const databaseName = 'cruddl';
@@ -30,7 +30,10 @@ export async function start() {
3030
await db.updateSchema(schema);
3131
logger.info('Schema is up to date');
3232

33-
new GraphQLServer({
34-
port, schema: schema
33+
const server = new GraphQLServer({
34+
schema,
35+
context: { authRoles: ["allusers", "logistics-reader" ]}
3536
});
37+
await server.start({port});
38+
logger.info(`Server started on http//localhost:${port}`);
3639
}

0 commit comments

Comments
 (0)