Skip to content
This repository was archived by the owner on Sep 12, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/commands/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ class DevCommand extends Command {

startDevServer(settings, this.log, this.error);

// serve functions from zip-it-and-ship-it
// env variables relies on `url`, careful moving this code
if (functionsDir) {
const functionBuilder = await detectFunctionsBuilder(settings);
if (functionBuilder) {
Expand Down Expand Up @@ -272,6 +274,9 @@ class DevCommand extends Command {
chalk.bold(`${NETLIFYDEVLOG} Server now ready on ${url}`),
70
);
process.env.URL = url;
process.env.DEPLOY_URL = process.env.URL;

this.log(
boxen(banner, {
padding: 1,
Expand Down
24 changes: 24 additions & 0 deletions src/functions-templates/js/apollo-graphql/apollo-graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,37 @@ const { ApolloServer, gql } = require("apollo-server-lambda");
const typeDefs = gql`
type Query {
hello: String
allAuthors: [Author!]
author(id: Int!): Author
authorByName(name: String!): Author
}
type Author {
id: ID!
name: String!
married: Boolean!
}
`;

const authors = [
{ id: 1, name: "Terry Pratchett", married: false },
{ id: 2, name: "Stephen King", married: true },
{ id: 3, name: "JK Rowling", married: false }
];

const resolvers = {
Query: {
hello: (root, args, context) => {
return "Hello, world!";
},
allAuthors: (root, args, context) => {
return authors;
},
author: (root, args, context) => {
return;
},
authorByName: (root, args, context) => {
console.log("hihhihi", args.name);
return authors.find(x => x.name === args.name) || "NOTFOUND";
}
}
};
Expand Down
Loading