mirror of
https://github.com/seigler/graphql-playground
synced 2025-07-27 01:26:10 +00:00
feat: client retrieves data from GraphQL
This commit is contained in:
parent
7bc3484b71
commit
c333883162
9 changed files with 85 additions and 8 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue