Skip to content

Commit ceda622

Browse files
committed
Task_5_Done
1 parent 4d65086 commit ceda622

File tree

16 files changed

+153
-19
lines changed

16 files changed

+153
-19
lines changed

package-lock.json

Lines changed: 126 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "index.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
8-
"start": "nodemon -r dotenv/config src/server.js",
8+
"start": "nodemon -r dotenv/config src/server",
99
"lint": "eslint --ignore-path .gitignore ."
1010
},
1111
"husky": {
@@ -24,15 +24,18 @@
2424
},
2525
"homepage": "https://github.com/RisingStack/jsconfbp-2019-graphql#readme",
2626
"dependencies": {
27+
"apollo-link-http": "1.5.16",
2728
"axios": "0.19.0",
2829
"bcrypt": "^3.0.6",
2930
"cors": "^2.8.5",
3031
"express": "^4.17.1",
3132
"express-graphql": "^0.9.0",
3233
"graphql": "^14.5.4",
34+
"graphql-tools": "4.0.5",
3335
"helmet": "^3.21.0",
3436
"knex": "^0.19.3",
3537
"lodash": "^4.17.15",
38+
"node-fetch": "2.6.0",
3639
"pg": "^7.12.1",
3740
"uuidv4": "^5.0.1"
3841
},

scripts/createTestData.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
require('dotenv/config');
55

6-
const db = require('../src/db');
6+
const db = require('../src/server/db');
77

88
Promise.all(db.createTables()).then(() => {
99
Promise.all(db.createTestData()).then(() => {

scripts/dropTables.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
require('dotenv/config');
55

6-
const db = require('../src/db');
6+
const db = require('../src/server/db');
77

88
Promise.all(db.dropTables()).then(() => {
99
console.log('Tables dropped.');
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/server.js renamed to src/server/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ const express = require('express');
22
const graphqlHTTP = require('express-graphql');
33
const helmet = require('helmet');
44
const cors = require('cors');
5+
const { mergeSchemas } = require('graphql-tools');
6+
const pokemonSchema = require('./pokemonSchema');
57

68
const db = require('./db');
79

@@ -25,7 +27,9 @@ app.use(cors({
2527
}));
2628

2729
app.use('/graphql', graphqlHTTP(async () => ({
28-
schema,
30+
schema: mergeSchemas({
31+
schemas: [schema, await pokemonSchema()],
32+
}),
2933
// rootValue,
3034
graphiql: true,
3135
customFormatErrorFn: (error) => {

0 commit comments

Comments
 (0)