Skip to content

Instantly share code, notes, and snippets.

@lewisdaly
Last active June 4, 2018 00:42
Show Gist options
  • Save lewisdaly/f135c735a727be2d4bbdbea698350ba6 to your computer and use it in GitHub Desktop.
Save lewisdaly/f135c735a727be2d4bbdbea698350ba6 to your computer and use it in GitHub Desktop.
'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