Skip to content

Instantly share code, notes, and snippets.

@ljack
Created April 19, 2016 17:33
Show Gist options
  • Save ljack/7c03b1c2bc081394a6a37f50cb425154 to your computer and use it in GitHub Desktop.
Save ljack/7c03b1c2bc081394a6a37f50cb425154 to your computer and use it in GitHub Desktop.
apimoon wip server
import {
apolloServer
}
from 'graphql-tools';
import express from 'express';
import bodyParser from 'body-parser';
const app = express();
app.use(bodyParser.urlencoded({
extended: true
}));
app.use(bodyParser.json());
app.use('/apimoon-server', function(req, res) {
// console.log("apimoon-server request running.., req=",req);
let queryJson = req.body;
console.log("queryJSON=", JSON.stringify(queryJson, null, 2));
var server = apolloServer({
schema: queryJson.schema,
resolvers: queryJson.resolvers,
connectors: queryJson.connectors,
printErrors: true,
});
return server(req, res);
});
var server = app.listen(8080, function() {
var port = server.address().port;
console.log('Example app listening at port %s', port);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment