Created
April 19, 2016 17:33
-
-
Save ljack/7c03b1c2bc081394a6a37f50cb425154 to your computer and use it in GitHub Desktop.
apimoon wip server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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