-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
17 lines (15 loc) · 816 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const express = require('express');
const bodyParser = require('body-parser');
const { graphqlExpress, graphiqlExpress } = require('graphql-server-express');
const { makeExecutableSchema } = require('graphql-tools');
const dynamoConnection = require('./src/database/pallet_op.js')
const s = require('./src/graphql/schema/schema.js')
const resolvers = require('./src/graphql/resolvers.js').getResolver()
var typeDefs = s.typeDefs();
var palletSchema = s.palletSchema();
var schema = makeExecutableSchema({ typeDefs, resolvers });
var app = express();
app.use('/graphql', bodyParser.json(), graphqlExpress({ schema }));
app.use('/graphiql', graphiqlExpress({ endpointURL: '/graphql' }));
console.log('waiting for dynamodb response.....')
app.listen(4000, () => console.log('Now browse to localhost:4000/graphiql'));