Last active
June 4, 2018 00:42
-
-
Save lewisdaly/f135c735a727be2d4bbdbea698350ba6 to your computer and use it in GitHub Desktop.
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
'use strict'; | |
const server = require("apollo-server-lambda"); | |
const schema = require('./schema'); | |
exports.graphql = server.graphqlLambda((event, context) => { | |
const headers = event.headers; | |
const functionName = context.functionName; | |
return { | |
schema: schema, | |
context: { | |
headers, | |
functionName, | |
event, | |
context | |
} | |
}; | |
}); | |
exports.graphiql = server.graphiqlLambda({ | |
endpointURL: '/Prod/graphql' | |
}); | |
exports.hello = (event, context, callback) => { | |
const response = { | |
statusCode: 200, | |
body: JSON.stringify({ | |
message: 'Go Serverless v1.0! Your function executed successfully!', | |
input: event, | |
}), | |
}; | |
callback(null, response); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment