Issues (37)

1
import express from 'express';
2
import graphqlHTTP from 'express-graphql';
3
import mongoose from 'mongoose';
4
mongoose.Promise = global.Promise;
5
6
import schema from './graphql';
7
8
var app = express();
9
10
// GraphqQL server route
11
app.use('/graphql', graphqlHTTP(req => ({
12
  schema,
13
  pretty: true,
14
  graphiql: true
15
})));
16
17
// Connect mongo database
18
mongoose.connect('mongodb://localhost/graphql');
19
20
// start server
21
let server = app.listen(4000, function () {
22
  var host = server.address().address;
23
  var port = server.address().port;
24
25
  console.log('GraphQL listening at http://%s:%s', host, port);
0 ignored issues
show
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
26
});
27
28
export default server;
29