Skip to content

Commit d51be5a

Browse files
committed
adding a graphql-yoga example with playground (graphiql) built-in
1 parent 0b81039 commit d51be5a

File tree

6 files changed

+2607
-0
lines changed

6 files changed

+2607
-0
lines changed

graphql-yoga-helloworld/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
.serverless

graphql-yoga-helloworld/handler.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const { GraphQLServerLambda } = require("graphql-yoga");
2+
var fs = require("fs")
3+
4+
const typeDefs = fs.readFileSync("./schema.gql").toString('utf-8');
5+
6+
const resolvers = {
7+
Query: {
8+
"hello": () => {
9+
return 'pickles';
10+
}
11+
}
12+
};
13+
14+
const lambda = new GraphQLServerLambda({
15+
typeDefs,
16+
resolvers
17+
});
18+
19+
exports.server = lambda.graphqlHandler;
20+
exports.playground = lambda.playgroundHandler;

0 commit comments

Comments
 (0)