feat: client retrieves data from GraphQL

This commit is contained in:
Joshua Seigler 2020-01-31 00:54:13 -05:00
parent 7bc3484b71
commit c333883162
9 changed files with 85 additions and 8 deletions

View file

@ -1,5 +1,6 @@
const express = require('express');
const graphqlHTTP = require('express-graphql');
const cors = require('cors');
const mongoose = require('mongoose');
require('dotenv-safe').config();
@ -15,6 +16,8 @@ mongoose.connection.once('open', () => {
console.log('Connected to database.');
});
app.use(cors({ origin: 'http://localhost:1234' }));
app.use('/graphql', graphqlHTTP({
schema,
graphiql: true

View file

@ -1,5 +1,5 @@
{
"name": "graphql-playground",
"name": "graphql-playground-server",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
@ -245,6 +245,15 @@
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
},
"cors": {
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
"requires": {
"object-assign": "^4",
"vary": "^1"
}
},
"create-error-class": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz",
@ -934,6 +943,11 @@
"path-key": "^2.0.0"
}
},
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
},
"on-finished": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",

View file

@ -18,6 +18,7 @@
},
"homepage": "https://github.com/seigler/graphql-playground#readme",
"dependencies": {
"cors": "^2.8.5",
"dotenv-safe": "^8.2.0",
"express": "^4.17.1",
"express-graphql": "^0.9.0",