From d6a3cf337f66f0718f7e8d5fc725836582f6055b Mon Sep 17 00:00:00 2001 From: Tirumarai Selvan Date: Tue, 5 Mar 2019 21:45:39 +0530 Subject: [PATCH] add hello-world remote-schema boilerplates for major serverless providers (#1694) A hello world schema is provided with local dev and deployment instructions for AWS Lambda, Google Cloud Functions and Azure Functions. Older boilerplates are cleaned up. --- .../zeit-serverless-docker/README.md | 1 - .../graphql-servers/nodejs-apollo/README.md | 2 +- .../graphql-servers/nodejs-express/README.md | 2 +- .../aws-lambda/nodejs/.gitignore | 3 + .../aws-lambda/nodejs/README.md | 76 + .../nodejs/apollo-sequelize/.gitignore | 3 - .../nodejs/apollo-sequelize/README.md | 104 -- .../nodejs/apollo-sequelize/index.js | 85 - .../nodejs/apollo-sequelize/models.js | 37 - .../nodejs/apollo-sequelize/package-lock.json | 1374 ----------------- .../remote-schemas/aws-lambda/nodejs/index.js | 16 + .../aws-lambda/nodejs/lambdaCtx.js | 22 + .../aws-lambda/nodejs/localDev.js | 11 + .../{apollo-sequelize => }/package.json | 7 +- .../azure-functions/nodejs/.gitignore | 3 + .../azure-functions/nodejs/README.md | 83 + .../azure-functions/nodejs/graphql/.gitignore | 3 + .../nodejs/graphql/function.json | 20 + .../nodejs/graphql/localDev.js | 11 + .../nodejs/graphql/package.json | 17 + .../azure-functions/nodejs/graphql/run.js | 16 + .../azure-functions/nodejs/graphql/server.js | 16 + .../azure-functions/nodejs/host.json | 19 + .../nodejs/.gcloudignore | 17 + .../google-cloud-functions/nodejs/.gitignore | 3 + .../google-cloud-functions/nodejs/README.md | 62 + .../nodejs/googleCtx.js | 23 + .../google-cloud-functions/nodejs/index.js | 16 + .../google-cloud-functions/nodejs/localDev.js | 11 + .../nodejs/package.json | 17 + .../nodejs/{apollo-sequelize => }/.gitignore | 0 .../nodejs/{apollo-sequelize => }/Dockerfile | 0 .../nodejs/{apollo-sequelize => }/README.md | 28 +- .../nodejs/apollo-sequelize/models.js | 37 - .../nodejs/apollo-sequelize/server.js | 71 - .../express-graphqljs-sequelize/.gitignore | 2 - .../express-graphqljs-sequelize/Dockerfile | 11 - .../express-graphqljs-sequelize/README.md | 80 - .../express-graphqljs-sequelize/models.js | 37 - .../express-graphqljs-sequelize/now.json | 3 - .../express-graphqljs-sequelize/package.json | 22 - .../express-graphqljs-sequelize/server.js | 67 - .../nodejs/{apollo-sequelize => }/now.json | 0 .../{apollo-sequelize => }/package.json | 9 +- .../remote-schemas/zeit-now/nodejs/server.js | 29 + 45 files changed, 506 insertions(+), 1970 deletions(-) delete mode 100644 community/boilerplates/event-triggers/zeit-serverless-docker/README.md create mode 100644 community/boilerplates/remote-schemas/aws-lambda/nodejs/.gitignore create mode 100644 community/boilerplates/remote-schemas/aws-lambda/nodejs/README.md delete mode 100644 community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/.gitignore delete mode 100644 community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/README.md delete mode 100644 community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/index.js delete mode 100644 community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/models.js delete mode 100644 community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/package-lock.json create mode 100644 community/boilerplates/remote-schemas/aws-lambda/nodejs/index.js create mode 100644 community/boilerplates/remote-schemas/aws-lambda/nodejs/lambdaCtx.js create mode 100644 community/boilerplates/remote-schemas/aws-lambda/nodejs/localDev.js rename community/boilerplates/remote-schemas/aws-lambda/nodejs/{apollo-sequelize => }/package.json (69%) create mode 100644 community/boilerplates/remote-schemas/azure-functions/nodejs/.gitignore create mode 100644 community/boilerplates/remote-schemas/azure-functions/nodejs/README.md create mode 100644 community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/.gitignore create mode 100644 community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/function.json create mode 100644 community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/localDev.js create mode 100644 community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/package.json create mode 100644 community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/run.js create mode 100644 community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/server.js create mode 100644 community/boilerplates/remote-schemas/azure-functions/nodejs/host.json create mode 100644 community/boilerplates/remote-schemas/google-cloud-functions/nodejs/.gcloudignore create mode 100644 community/boilerplates/remote-schemas/google-cloud-functions/nodejs/.gitignore create mode 100644 community/boilerplates/remote-schemas/google-cloud-functions/nodejs/README.md create mode 100644 community/boilerplates/remote-schemas/google-cloud-functions/nodejs/googleCtx.js create mode 100644 community/boilerplates/remote-schemas/google-cloud-functions/nodejs/index.js create mode 100644 community/boilerplates/remote-schemas/google-cloud-functions/nodejs/localDev.js create mode 100644 community/boilerplates/remote-schemas/google-cloud-functions/nodejs/package.json rename community/boilerplates/remote-schemas/zeit-now/nodejs/{apollo-sequelize => }/.gitignore (100%) rename community/boilerplates/remote-schemas/zeit-now/nodejs/{apollo-sequelize => }/Dockerfile (100%) rename community/boilerplates/remote-schemas/zeit-now/nodejs/{apollo-sequelize => }/README.md (50%) delete mode 100644 community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/models.js delete mode 100644 community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/server.js delete mode 100644 community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/.gitignore delete mode 100644 community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/Dockerfile delete mode 100644 community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/README.md delete mode 100644 community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/models.js delete mode 100644 community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/now.json delete mode 100644 community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/package.json delete mode 100644 community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/server.js rename community/boilerplates/remote-schemas/zeit-now/nodejs/{apollo-sequelize => }/now.json (100%) rename community/boilerplates/remote-schemas/zeit-now/nodejs/{apollo-sequelize => }/package.json (66%) create mode 100644 community/boilerplates/remote-schemas/zeit-now/nodejs/server.js diff --git a/community/boilerplates/event-triggers/zeit-serverless-docker/README.md b/community/boilerplates/event-triggers/zeit-serverless-docker/README.md deleted file mode 100644 index cfed6361c29..00000000000 --- a/community/boilerplates/event-triggers/zeit-serverless-docker/README.md +++ /dev/null @@ -1 +0,0 @@ -Moved to [zeit-now](../zeit-now) diff --git a/community/boilerplates/graphql-servers/nodejs-apollo/README.md b/community/boilerplates/graphql-servers/nodejs-apollo/README.md index 957a1ce387b..cdb60479d16 100644 --- a/community/boilerplates/graphql-servers/nodejs-apollo/README.md +++ b/community/boilerplates/graphql-servers/nodejs-apollo/README.md @@ -1,3 +1,3 @@ # (MOVED) GraphQL server using NodeJS and Apollo -**This folder has been moved to [remote-schemas/zeit-now/nodejs/apollo-sequelize](../../remote-schemas/zeit-now/nodejs/apollo-sequelize)** +**This folder has been moved to [remote-schemas/aws-lambda/nodejs](../../remote-schemas/aws-lambda/nodejs)** diff --git a/community/boilerplates/graphql-servers/nodejs-express/README.md b/community/boilerplates/graphql-servers/nodejs-express/README.md index 4df1d2b4a19..bb29dcaffd7 100644 --- a/community/boilerplates/graphql-servers/nodejs-express/README.md +++ b/community/boilerplates/graphql-servers/nodejs-express/README.md @@ -1,3 +1,3 @@ # (MOVED) GraphQL server using NodeJS-Express -**This folder has been moved to [remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize](../../remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize)** +**This folder has been moved to [remote-schemas/aws-lambda/nodejs](../../remote-schemas/aws-lambda/nodejs)** diff --git a/community/boilerplates/remote-schemas/aws-lambda/nodejs/.gitignore b/community/boilerplates/remote-schemas/aws-lambda/nodejs/.gitignore new file mode 100644 index 00000000000..3b776d7f9e6 --- /dev/null +++ b/community/boilerplates/remote-schemas/aws-lambda/nodejs/.gitignore @@ -0,0 +1,3 @@ +node_modules/ +*.zip +package-lock.json diff --git a/community/boilerplates/remote-schemas/aws-lambda/nodejs/README.md b/community/boilerplates/remote-schemas/aws-lambda/nodejs/README.md new file mode 100644 index 00000000000..14b2a63d7ec --- /dev/null +++ b/community/boilerplates/remote-schemas/aws-lambda/nodejs/README.md @@ -0,0 +1,76 @@ +# AWS Lambda + NodeJS + Apollo + +This is a GraphQL backend boilerplate in nodejs that can be deployed on AWS Lambda. + +## Stack + +node 8.10 + +AWS Lambda + +#### Frameworks/Libraries + +Apollo Server (GraphQL framework) + +## Schema + + +``` +type Query { + hello: String +} +``` + +## Local Development + +The sample source code is present in `index.js`. + +```bash +$ git clone git@github.com:hasura/graphql-engine +$ cd graphql-engine/community/boilerplates/remote-schemas/aws-lambda/nodejs +``` + +Start a local development server (you may need to install dependencies from npm): + +```bash +$ npm i --no-save apollo-server express +$ node localDev.js + +Output: + +Server ready at http://localhost:4000/ +``` + +This will start a local server on `localhost:4000`. You can hit the graphql service at `localhost:4000`. This opens a graphql playground where you can query your schema. + +## Deployment + +Now that you have run the graphql service locally and made any required changes, it's time to deploy your service to AWS Lambda and get an endpoint. The easiest way to do this is through the AWS console. + +1) Create a Lambda function by clicking on Create Function on your Lambda console. Choose the `NodeJS 8.10` runtime and `lambda_basic_execution` role. + +![create-lambda](../../_assets/create-lambda.png) + +2) In the next page (or Lambda instance page), select API Gateway as the trigger. + +![create-api-gateway](../../_assets/create-api-gateway.png) + +3) Configure the API Gateway as you wish. The simplest configuration is shown below. + +![configure-api-gateway](../../_assets/configure-api-gateway.png) + +Save your changes. You will receive a HTTPS endpoint for your lambda. + +![output-api-gateway](../../_assets/output-api-gateway.png) + +If you go to the endpoint, you will receive a "Hello from Lambda!" message. This is because we haven't uploaded any code yet! + +4) Zip and upload code. Make sure the handler is set as `lambdaCtx.handler`: + +```bash +$ zip -r graphql.zip * +``` + +And that's it. Hit save and visit the endpoint again. You will see the graphql playground again. + +**IMPORTANT NOTE:** You may have to edit the GraphQL URL in the Playground to reflect the right endpoint ( same as the URL created by the API Gateway ). diff --git a/community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/.gitignore b/community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/.gitignore deleted file mode 100644 index 6bb8fea5adc..00000000000 --- a/community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -build -*.zip diff --git a/community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/README.md b/community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/README.md deleted file mode 100644 index 6ddd571aca9..00000000000 --- a/community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/README.md +++ /dev/null @@ -1,104 +0,0 @@ -# AWS Lambda + NodeJS + Apollo + Sequelize - -This is a GraphQL backend boilerplate in nodejs that can be deployed on AWS Lambda. - -## Stack - -node 8.10 - -Postgres - -AWS Lambda - -#### Frameworks/Libraries - -Apollo Server (GraphQL framework) - -Sequelize (Postgres ORM) - -## Schema - -We consider a user schema where a user can be added only if a custom validation passes. The custom validation involves fetching a min amount from a table and checking if the user balance is greater than the min amount. This will be done in a transaction. - -``` -type Query { - hello: String -} - -type Mutation { - validateAndAddUser(name: String, balance: Int): User -} - -type User { - id: Int - name: String - balance: Int -} -``` - -## Local Development - -The sample source code is present in `index.js`. Clone the repo and go to `community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize` folder: - -```bash -$ git clone git@github.com:hasura/graphql-engine -$ cd graphql-engine/community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize -``` - -1) First, let's set the environment variable for connecting to the postgres instance. This can be a local postgres instance or some managed postgres instance like AWS RDS. - -```bash -$ export POSTGRES_CONNECTION_STRING='postgres://username:password@rds-database-endpoint.us-east-1.rds.amazonaws.com:5432/mydb' -``` - -2) Next, lets create the tables required for our schema. - -```bash -psql $POSTGRES_CONNECTION_STRING -c "create table users(id serial primary key, name text, balance integer); create table min_amount(amount integer); insert into min_amount values (100)" -``` - -3) Now, you can start a development environment by setting an environment variable and running the server: - -```bash -$ LAMBDA_LOCAL_DEVELOPMENT=1 node index.js - -Output: - -Server ready at http://localhost:4000/ -``` - -This will start a local server on `localhost:4000`. You can hit the graphql service at `localhost:4000`. This opens a graphql playground where you can query your schema. - -Now, you can play with the schema and make any changes in the source code for additional functionalities as you desire. - -## Deployment - -Now that you have run the graphql service locally and made any required changes, it's time to deploy your service to AWS Lambda and get an endpoint. The easiest way to do this is through the AWS console. - -1) Create a Lambda function by clicking on Create Function on your Lambda console. Choose the `NodeJS 8.10` runtime and `lambda_basic_execution` role. - -![create-lambda](../../../_assets/create-lambda.png) - -2) In the next page (or Lambda instance page), select API Gateway as the trigger. - -![create-api-gateway](../../../_assets/create-api-gateway.png) - -3) Configure the API Gateway as you wish. The simplest configuration is shown below. - -![configure-api-gateway](../../../_assets/configure-api-gateway.png) - -Save your changes. You will receive a HTTPS endpoint for your lambda. - -![output-api-gateway](../../../_assets/output-api-gateway.png) - -If you go to the endpoint, you will receive a "Hello from Lambda!" message. This is because we haven't uploaded any code yet! - -4) Zip and upload code. Make sure to set the handler as `index.handler` and add the `POSTGRES_CONNECTION_STRING` environment variable: - -```bash -$ zip -r graphql.zip * -``` - -And that's it. Hit save and visit the endpoint again. You will see the graphql playground again. - -**IMPORTANT NOTE:** You may have to edit the GraphQL URL in the Playground to reflect the right endpoint ( same as the URL created by the API Gateway ). diff --git a/community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/index.js b/community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/index.js deleted file mode 100644 index 20f30271b3b..00000000000 --- a/community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/index.js +++ /dev/null @@ -1,85 +0,0 @@ -const { ApolloServer, gql } = require('apollo-server'); -const ApolloServerLambda = require('apollo-server-lambda').ApolloServer; -const Sequelize = require("sequelize"); -const {User, MinAmount, sequelize} = require('./models.js'); - -const typeDefs = gql` - type Query { - hello: String - } - - type Mutation { - validateAndAddUser(name: String, balance: Int): User - } - - type User { - id: Int - name: String - balance: Int - } -`; - - -// We consider a user schema where a user can be added only if a custom validation passes. -// The custom validation involves fetching a min amount from a table -// and checking if the user balance is greater than the min amount. -// This will be done in a transaction. - -const resolvers = { - Query: { - hello: () => "world", - }, - Mutation: { - validateAndAddUser: async (_, { name, balance }) => { - //begin transaction - return await sequelize.transaction(async (t) => { - try { - //fetch min amount - const minAmount = await MinAmount.findOne({}, {transaction: t}); - //check balance - if (balance >= minAmount.amount) { - //create user if balance is greater - const user = await User.create({ - name: name, - balance: balance - }); - return user; - } else { - throw new Error("balance too low, required atleast " + minAmount.amount); - } - } catch (e) { - console.log(e); - throw new Error(e); - } - }); - } - } -}; - -const server = new ApolloServerLambda({ - typeDefs, - resolvers, - context: ({ event, context }) => ({ - headers: event.headers, - functionName: context.functionName, - event, - context, - }), -}); - -exports.handler = server.createHandler({ - cors: { - origin: '*', - credentials: true, - allowedHeaders: 'Content-Type, Authorization' - }, -}); - -// For local development -if( process.env.LAMBDA_LOCAL_DEVELOPMENT == "1") { - const serverLocal = new ApolloServer({ typeDefs, resolvers }); - - serverLocal.listen().then(({ url }) => { - console.log(`Server ready at ${url}`); - }); -} diff --git a/community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/models.js b/community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/models.js deleted file mode 100644 index b4652e9b846..00000000000 --- a/community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/models.js +++ /dev/null @@ -1,37 +0,0 @@ -const Sequelize = require("sequelize"); - -const POSTGRES_CONNECTION_STRING = process.env.POSTGRES_CONNECTION_STRING || "postgres://postgres:password@localhost:6432/postgres"; - -const sequelize = new Sequelize( - POSTGRES_CONNECTION_STRING, {} -); - -const User = sequelize.define( - 'user', - { - id: { type: Sequelize.INTEGER, autoIncrement: true, primaryKey: true }, - name: Sequelize.TEXT, - balance: Sequelize.INTEGER - }, - { - timestamps: false - } -); - -const MinAmount = sequelize.define( - 'min_amount', - { - amount: Sequelize.INTEGER - }, - { - freezeTableName: true, - timestamps: false - } -); - -MinAmount.removeAttribute('id'); - -exports.sequelize = sequelize; -exports.User = User; -exports.MinAmount = MinAmount; - diff --git a/community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/package-lock.json b/community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/package-lock.json deleted file mode 100644 index 809cfe2086d..00000000000 --- a/community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/package-lock.json +++ /dev/null @@ -1,1374 +0,0 @@ -{ - "name": "aws-lambda-nodejs", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@apollographql/apollo-tools": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/@apollographql/apollo-tools/-/apollo-tools-0.2.8.tgz", - "integrity": "sha512-A7FTUigtpGCFBaLT1ILicdjM6pZ7LQNw7Vgos0t4aLYtvlKO/L1nMi/NO7bPypzZaJSToTgcxHJPRydP1Md+Kw==", - "requires": { - "apollo-env": "0.2.5" - } - }, - "@apollographql/apollo-upload-server": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/@apollographql/apollo-upload-server/-/apollo-upload-server-5.0.3.tgz", - "integrity": "sha512-tGAp3ULNyoA8b5o9LsU2Lq6SwgVPUOKAqKywu2liEtTvrFSGPrObwanhYwArq3GPeOqp2bi+JknSJCIU3oQN1Q==", - "requires": { - "@babel/runtime-corejs2": "^7.0.0-rc.1", - "busboy": "^0.2.14", - "object-path": "^0.11.4" - } - }, - "@apollographql/graphql-playground-html": { - "version": "1.6.4", - "resolved": "https://registry.npmjs.org/@apollographql/graphql-playground-html/-/graphql-playground-html-1.6.4.tgz", - "integrity": "sha512-gwvaQO6/Hv4DEwhDLmmu2tzCU9oPjC5Xl9Kk8Yd0IxyKhYLlLalmkMMjsZLzU5H3fGaalLD96OYfxHL0ClVUDQ==" - }, - "@babel/runtime-corejs2": { - "version": "7.1.5", - "resolved": "https://registry.npmjs.org/@babel/runtime-corejs2/-/runtime-corejs2-7.1.5.tgz", - "integrity": "sha512-WsYRwQsFhVmxkAqwypPTZyV9GpkqMEaAr2zOItOmqSX2GBFaI+eq98CN81e13o0zaUKJOQGYyjhNVqj56nnkYg==", - "requires": { - "core-js": "^2.5.7", - "regenerator-runtime": "^0.12.0" - }, - "dependencies": { - "core-js": { - "version": "2.5.7", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", - "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" - } - } - }, - "@protobufjs/aspromise": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=" - }, - "@protobufjs/base64": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" - }, - "@protobufjs/codegen": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" - }, - "@protobufjs/eventemitter": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=" - }, - "@protobufjs/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", - "requires": { - "@protobufjs/aspromise": "^1.1.1", - "@protobufjs/inquire": "^1.1.0" - } - }, - "@protobufjs/float": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=" - }, - "@protobufjs/inquire": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=" - }, - "@protobufjs/path": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=" - }, - "@protobufjs/pool": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=" - }, - "@protobufjs/utf8": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" - }, - "@types/accepts": { - "version": "1.3.5", - "resolved": "http://registry.npmjs.org/@types/accepts/-/accepts-1.3.5.tgz", - "integrity": "sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==", - "requires": { - "@types/node": "*" - } - }, - "@types/body-parser": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.17.0.tgz", - "integrity": "sha512-a2+YeUjPkztKJu5aIF2yArYFQQp8d51wZ7DavSHjFuY1mqVgidGyzEQ41JIVNy82fXj8yPgy2vJmfIywgESW6w==", - "requires": { - "@types/connect": "*", - "@types/node": "*" - } - }, - "@types/connect": { - "version": "3.4.32", - "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.32.tgz", - "integrity": "sha512-4r8qa0quOvh7lGD0pre62CAb1oni1OO6ecJLGCezTmhQ8Fz50Arx9RUszryR8KlgK6avuSXvviL6yWyViQABOg==", - "requires": { - "@types/node": "*" - } - }, - "@types/cors": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.4.tgz", - "integrity": "sha512-ipZjBVsm2tF/n8qFGOuGBkUij9X9ZswVi9G3bx/6dz7POpVa6gVHcj1wsX/LVEn9MMF41fxK/PnZPPoTD1UFPw==", - "requires": { - "@types/express": "*" - } - }, - "@types/events": { - "version": "1.2.0", - "resolved": "http://registry.npmjs.org/@types/events/-/events-1.2.0.tgz", - "integrity": "sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA==" - }, - "@types/express": { - "version": "4.16.0", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.16.0.tgz", - "integrity": "sha512-TtPEYumsmSTtTetAPXlJVf3kEqb6wZK0bZojpJQrnD/djV4q1oB6QQ8aKvKqwNPACoe02GNiy5zDzcYivR5Z2w==", - "requires": { - "@types/body-parser": "*", - "@types/express-serve-static-core": "*", - "@types/serve-static": "*" - } - }, - "@types/express-serve-static-core": { - "version": "4.16.0", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.16.0.tgz", - "integrity": "sha512-lTeoCu5NxJU4OD9moCgm0ESZzweAx0YqsAcab6OB0EB3+As1OaHtKnaGJvcngQxYsi9UNv0abn4/DRavrRxt4w==", - "requires": { - "@types/events": "*", - "@types/node": "*", - "@types/range-parser": "*" - } - }, - "@types/geojson": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-1.0.6.tgz", - "integrity": "sha512-Xqg/lIZMrUd0VRmSRbCAewtwGZiAk3mEUDvV4op1tGl+LvyPcb/MIOSxTl9z+9+J+R4/vpjiCAT4xeKzH9ji1w==" - }, - "@types/long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.0.tgz", - "integrity": "sha512-1w52Nyx4Gq47uuu0EVcsHBxZFJgurQ+rTKS3qMHxR1GY2T8c2AJYd6vZoZ9q1rupaDjU0yT+Jc2XTyXkjeMA+Q==" - }, - "@types/mime": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.0.tgz", - "integrity": "sha512-A2TAGbTFdBw9azHbpVd+/FkdW2T6msN1uct1O9bH3vTerEHKZhTXJUQXy+hNq1B0RagfU8U+KBdqiZpxjhOUQA==" - }, - "@types/node": { - "version": "10.12.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.10.tgz", - "integrity": "sha512-8xZEYckCbUVgK8Eg7lf5Iy4COKJ5uXlnIOnePN0WUwSQggy9tolM+tDJf7wMOnT/JT/W9xDYIaYggt3mRV2O5w==" - }, - "@types/range-parser": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.2.tgz", - "integrity": "sha512-HtKGu+qG1NPvYe1z7ezLsyIaXYyi8SoAVqWDZgDQ8dLrsZvSzUNCwZyfX33uhWxL/SU0ZDQZ3nwZ0nimt507Kw==" - }, - "@types/serve-static": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.2.tgz", - "integrity": "sha512-/BZ4QRLpH/bNYgZgwhKEh+5AsboDBcUdlBYgzoLX0fpj3Y2gp6EApyOlM3bK53wQS/OE1SrdSYBAbux2D1528Q==", - "requires": { - "@types/express-serve-static-core": "*", - "@types/mime": "*" - } - }, - "@types/ws": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-6.0.1.tgz", - "integrity": "sha512-EzH8k1gyZ4xih/MaZTXwT2xOkPiIMSrhQ9b8wrlX88L0T02eYsddatQlwVFlEPyEqV0ChpdpNnE51QPH6NVT4Q==", - "requires": { - "@types/events": "*", - "@types/node": "*" - } - }, - "accepts": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", - "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", - "requires": { - "mime-types": "~2.1.18", - "negotiator": "0.6.1" - } - }, - "apollo-cache-control": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/apollo-cache-control/-/apollo-cache-control-0.3.2.tgz", - "integrity": "sha512-/fhgCWGEoTsgyA83usy/1NvJWi6hbD4rSGO5jvyNNtMZ9ledOvKUvIdzSQ1r5hxK5yds/eehWXhMJ4Pu200qrQ==", - "requires": { - "apollo-server-env": "2.2.0", - "graphql-extensions": "0.3.2" - } - }, - "apollo-datasource": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/apollo-datasource/-/apollo-datasource-0.2.0.tgz", - "integrity": "sha512-WJM9Ix3uogIfAG7mjL1NZQM9+45rcikn4mPWhE1Iuyw2+Y857J3uKJqQgF5h9Fg64SlCJh9u5WL3N7N5mg1fVw==", - "requires": { - "apollo-server-caching": "0.2.0", - "apollo-server-env": "2.2.0" - } - }, - "apollo-engine-reporting": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/apollo-engine-reporting/-/apollo-engine-reporting-0.1.2.tgz", - "integrity": "sha512-W6zBTypI2ZLe9ZpMI4EasyXJP2WG8CpxYOU3Q4iuCKh8HYJqrQC5QVFXRF7TRBQTE6tc1seYnAHdgqv0ozxBrw==", - "requires": { - "apollo-engine-reporting-protobuf": "0.1.0", - "apollo-server-env": "2.2.0", - "async-retry": "^1.2.1", - "graphql-extensions": "0.3.2", - "lodash": "^4.17.10" - } - }, - "apollo-engine-reporting-protobuf": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/apollo-engine-reporting-protobuf/-/apollo-engine-reporting-protobuf-0.1.0.tgz", - "integrity": "sha512-GReJtAYTmpwg0drb9VgFtqObYYTCHkJhlHEYCeXY8bJV4fOgXsAZ7CIXR9nPKO0mBaoHIHaGYvXGcyCLrZ36VA==", - "requires": { - "protobufjs": "^6.8.6" - } - }, - "apollo-env": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/apollo-env/-/apollo-env-0.2.5.tgz", - "integrity": "sha512-Gc7TEbwCl7jJVutnn8TWfzNSkrrqyoo0DP92BQJFU9pZbJhpidoXf2Sw1YwOJl82rRKH3ujM3C8vdZLOgpFcFA==", - "requires": { - "core-js": "^3.0.0-beta.3", - "node-fetch": "^2.2.0" - } - }, - "apollo-link": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/apollo-link/-/apollo-link-1.2.4.tgz", - "integrity": "sha512-B1z+9H2nTyWEhMXRFSnoZ1vSuAYP+V/EdUJvRx9uZ8yuIBZMm6reyVtr1n0BWlKeSFyPieKJy2RLzmITAAQAMQ==", - "requires": { - "apollo-utilities": "^1.0.0", - "zen-observable-ts": "^0.8.11" - } - }, - "apollo-server": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/apollo-server/-/apollo-server-2.2.2.tgz", - "integrity": "sha512-LiVId1s7o+4IqReyzqfqxVyNYr6BOGsaYyqUH4R5Vb0gRw5igmZEiYz4g+dqTrUT4Ktv2gDyFumM+MxNm+Gjqg==", - "requires": { - "apollo-server-core": "2.2.2", - "apollo-server-express": "2.2.2", - "express": "^4.0.0", - "graphql-subscriptions": "^1.0.0", - "graphql-tools": "^4.0.0" - } - }, - "apollo-server-caching": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/apollo-server-caching/-/apollo-server-caching-0.2.0.tgz", - "integrity": "sha512-/v7xWEcyyahs3hwX4baH/GekuHz3LRt9NoIYwg869G1eeqjuwY6NsowRIujZ100anJQwm9v5A9/sLtHBFvbgYg==", - "requires": { - "lru-cache": "^4.1.3" - } - }, - "apollo-server-core": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/apollo-server-core/-/apollo-server-core-2.2.2.tgz", - "integrity": "sha512-F6d4u5m1rJB4ucpLPGCoa9Dvo5OjGMIGdAzT9A35yOvlFWwvIR46jGmYmGmNp4Qx852rb1axSZVzNy7k/Dix0w==", - "requires": { - "@apollographql/apollo-tools": "^0.2.6", - "@apollographql/apollo-upload-server": "^5.0.3", - "@apollographql/graphql-playground-html": "^1.6.4", - "@types/ws": "^6.0.0", - "apollo-cache-control": "0.3.2", - "apollo-datasource": "0.2.0", - "apollo-engine-reporting": "0.1.2", - "apollo-server-caching": "0.2.0", - "apollo-server-env": "2.2.0", - "apollo-server-errors": "2.2.0", - "apollo-server-plugin-base": "0.1.2", - "apollo-tracing": "0.3.2", - "graphql-extensions": "0.3.2", - "graphql-subscriptions": "^1.0.0", - "graphql-tag": "^2.9.2", - "graphql-tools": "^4.0.0", - "json-stable-stringify": "^1.0.1", - "lodash": "^4.17.10", - "subscriptions-transport-ws": "^0.9.11", - "ws": "^6.0.0" - } - }, - "apollo-server-env": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/apollo-server-env/-/apollo-server-env-2.2.0.tgz", - "integrity": "sha512-wjJiI5nQWPBpNmpiLP389Ezpstp71szS6DHAeTgYLb/ulCw3CTuuA+0/E1bsThVWiQaDeHZE0sE3yI8q2zrYiA==", - "requires": { - "node-fetch": "^2.1.2", - "util.promisify": "^1.0.0" - } - }, - "apollo-server-errors": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/apollo-server-errors/-/apollo-server-errors-2.2.0.tgz", - "integrity": "sha512-gV9EZG2tovFtT1cLuCTavnJu2DaKxnXPRNGSTo+SDI6IAk6cdzyW0Gje5N2+3LybI0Wq5KAbW6VLei31S4MWmg==" - }, - "apollo-server-express": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/apollo-server-express/-/apollo-server-express-2.2.2.tgz", - "integrity": "sha512-DPxHOUd0Waztuix0r1ed6xfdlR7P7RzIXPmybhPXj1bZJtYHz5If0ngYNjtFqnXVrC8aSRtMz108SQUAnduYwA==", - "requires": { - "@apollographql/apollo-upload-server": "^5.0.3", - "@apollographql/graphql-playground-html": "^1.6.4", - "@types/accepts": "^1.3.5", - "@types/body-parser": "1.17.0", - "@types/cors": "^2.8.4", - "@types/express": "4.16.0", - "accepts": "^1.3.5", - "apollo-server-core": "2.2.2", - "body-parser": "^1.18.3", - "cors": "^2.8.4", - "graphql-subscriptions": "^1.0.0", - "graphql-tools": "^4.0.0", - "type-is": "^1.6.16" - } - }, - "apollo-server-lambda": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/apollo-server-lambda/-/apollo-server-lambda-2.2.2.tgz", - "integrity": "sha512-SI528pEQWAE+oxS23EKdahUAkfiNkaWBFUBU72+gbwefGNaEu24dLy3jX0X0+5m5pJm3nxS7HvXvsqTBbIr2GA==", - "requires": { - "@apollographql/graphql-playground-html": "^1.6.4", - "apollo-server-core": "2.2.2", - "apollo-server-env": "2.2.0", - "graphql-tools": "^4.0.0" - } - }, - "apollo-server-plugin-base": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/apollo-server-plugin-base/-/apollo-server-plugin-base-0.1.2.tgz", - "integrity": "sha512-+uicMcNctlP6YwIhzLLEycZzao/810OSzcxgPYKItXr5lGa1GuHD7sRIWldT3YoSdpw6Gal2lBuw6/DmnoDsPg==" - }, - "apollo-tracing": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/apollo-tracing/-/apollo-tracing-0.3.2.tgz", - "integrity": "sha512-YwN1m1k0JJsxGh0QWsEM3OLnyem0GT2tZnGeO2OogCr6dH5lE0SjKPc6UzpcI/3fPyxRrx5QvpUiP+DJeehhTA==", - "requires": { - "apollo-server-env": "2.2.0", - "graphql-extensions": "0.3.2" - } - }, - "apollo-utilities": { - "version": "1.0.26", - "resolved": "https://registry.npmjs.org/apollo-utilities/-/apollo-utilities-1.0.26.tgz", - "integrity": "sha512-URw7o3phymliqYCYatcird2YRPUU2eWCNvip64U9gQrX56mEfK4m99yBIDCMTpmcvOFsKLii1sIEZsHIs/bvnw==", - "requires": { - "fast-json-stable-stringify": "^2.0.0" - } - }, - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" - }, - "async-limiter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", - "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" - }, - "async-retry": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.2.3.tgz", - "integrity": "sha512-tfDb02Th6CE6pJUF2gjW5ZVjsgwlucVXOEQMvEX9JgSJMs9gAX+Nz3xRuJBKuUYjTSYORqvDBORdAQ3LU59g7Q==", - "requires": { - "retry": "0.12.0" - } - }, - "backo2": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", - "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=" - }, - "bluebird": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.3.tgz", - "integrity": "sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw==" - }, - "body-parser": { - "version": "1.18.3", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", - "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", - "requires": { - "bytes": "3.0.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "~1.6.3", - "iconv-lite": "0.4.23", - "on-finished": "~2.3.0", - "qs": "6.5.2", - "raw-body": "2.3.3", - "type-is": "~1.6.16" - } - }, - "buffer-writer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz", - "integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==" - }, - "busboy": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-0.2.14.tgz", - "integrity": "sha1-bCpiLvz0fFe7vh4qnDetNseSVFM=", - "requires": { - "dicer": "0.2.5", - "readable-stream": "1.1.x" - } - }, - "bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" - }, - "cls-bluebird": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cls-bluebird/-/cls-bluebird-2.1.0.tgz", - "integrity": "sha1-N+8eCAqP+1XC9BZPU28ZGeeWiu4=", - "requires": { - "is-bluebird": "^1.0.2", - "shimmer": "^1.1.0" - } - }, - "content-disposition": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", - "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" - }, - "cookie": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" - }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" - }, - "core-js": { - "version": "3.0.0-beta.3", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.0.0-beta.3.tgz", - "integrity": "sha512-kM/OfrnMThP5PwGAj5HhQLdjUqzjrllqN2EVnk/X9qrLsfYjR2hzZ+E/8CzH0xuosexZtqMTLQrk//BULrBj9w==" - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "cors": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", - "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", - "requires": { - "object-assign": "^4", - "vary": "^1" - } - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "requires": { - "object-keys": "^1.0.12" - } - }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" - }, - "deprecated-decorator": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/deprecated-decorator/-/deprecated-decorator-0.1.6.tgz", - "integrity": "sha1-AJZjF7ehL+kvPMgx91g68ym4bDc=" - }, - "destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" - }, - "dicer": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/dicer/-/dicer-0.2.5.tgz", - "integrity": "sha1-WZbAhrszIYyBLAkL3cCc0S+stw8=", - "requires": { - "readable-stream": "1.1.x", - "streamsearch": "0.1.2" - } - }, - "dottie": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/dottie/-/dottie-2.0.1.tgz", - "integrity": "sha512-ch5OQgvGDK2u8pSZeSYAQaV/lczImd7pMJ7BcEPXmnFVjy4yJIzP6CsODJUTH8mg1tyH1Z2abOiuJO3DjZ/GBw==" - }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" - }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" - }, - "es-abstract": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", - "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", - "requires": { - "es-to-primitive": "^1.1.1", - "function-bind": "^1.1.1", - "has": "^1.0.1", - "is-callable": "^1.1.3", - "is-regex": "^1.0.4" - } - }, - "es-to-primitive": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", - "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" - }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" - }, - "eventemitter3": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", - "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==" - }, - "express": { - "version": "4.16.4", - "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", - "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", - "requires": { - "accepts": "~1.3.5", - "array-flatten": "1.1.1", - "body-parser": "1.18.3", - "content-disposition": "0.5.2", - "content-type": "~1.0.4", - "cookie": "0.3.1", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.1.1", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.4", - "qs": "6.5.2", - "range-parser": "~1.2.0", - "safe-buffer": "5.1.2", - "send": "0.16.2", - "serve-static": "1.13.2", - "setprototypeof": "1.1.0", - "statuses": "~1.4.0", - "type-is": "~1.6.16", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "dependencies": { - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" - }, - "finalhandler": { - "version": "1.1.1", - "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", - "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "statuses": "~1.4.0", - "unpipe": "~1.0.0" - }, - "dependencies": { - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" - }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "generic-pool": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/generic-pool/-/generic-pool-3.4.2.tgz", - "integrity": "sha512-H7cUpwCQSiJmAHM4c/aFu6fUfrhWXW1ncyh8ftxEPMu6AiYkHw9K8br720TGPZJbk5eOH2bynjZD1yPvdDAmag==" - }, - "graphql": { - "version": "0.13.2", - "resolved": "http://registry.npmjs.org/graphql/-/graphql-0.13.2.tgz", - "integrity": "sha512-QZ5BL8ZO/B20VA8APauGBg3GyEgZ19eduvpLWoq5x7gMmWnHoy8rlQWPLmWgFvo1yNgjSEFMesmS4R6pPr7xog==", - "requires": { - "iterall": "^1.2.1" - } - }, - "graphql-extensions": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/graphql-extensions/-/graphql-extensions-0.3.2.tgz", - "integrity": "sha512-eIAWwtZNlUAHtHF6uNP6+4M+GCksqUYfNBxW5rTAlCB4/ZcuIvchVtN1CgVM7MooW3akPM1Eci11WyeXvgOugQ==", - "requires": { - "@apollographql/apollo-tools": "^0.2.6" - } - }, - "graphql-subscriptions": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/graphql-subscriptions/-/graphql-subscriptions-1.0.0.tgz", - "integrity": "sha512-+ytmryoHF1LVf58NKEaNPRUzYyXplm120ntxfPcgOBC7TnK7Tv/4VRHeh4FAR9iL+O1bqhZs4nkibxQ+OA5cDQ==", - "requires": { - "iterall": "^1.2.1" - } - }, - "graphql-tag": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.10.0.tgz", - "integrity": "sha512-9FD6cw976TLLf9WYIUPCaaTpniawIjHWZSwIRZSjrfufJamcXbVVYfN2TWvJYbw0Xf2JjYbl1/f2+wDnBVw3/w==" - }, - "graphql-tools": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/graphql-tools/-/graphql-tools-4.0.3.tgz", - "integrity": "sha512-NNZM0WSnVLX1zIMUxu7SjzLZ4prCp15N5L2T2ro02OVyydZ0fuCnZYRnx/yK9xjGWbZA0Q58yEO//Bv/psJWrg==", - "requires": { - "apollo-link": "^1.2.3", - "apollo-utilities": "^1.0.1", - "deprecated-decorator": "^0.1.6", - "iterall": "^1.1.3", - "uuid": "^3.1.0" - } - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" - }, - "http-errors": { - "version": "1.6.3", - "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" - } - }, - "iconv-lite": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", - "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "inflection": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/inflection/-/inflection-1.12.0.tgz", - "integrity": "sha1-ogCTVlbW9fa8TcdQLhrstwMihBY=" - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "ipaddr.js": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", - "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" - }, - "is-bluebird": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-bluebird/-/is-bluebird-1.0.2.tgz", - "integrity": "sha1-CWQ5Bg9KpBGr7hkUOoTWpVNG1uI=" - }, - "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" - }, - "is-date-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" - }, - "is-regex": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", - "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", - "requires": { - "has": "^1.0.1" - } - }, - "is-symbol": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", - "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", - "requires": { - "has-symbols": "^1.0.0" - } - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "iterall": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/iterall/-/iterall-1.2.2.tgz", - "integrity": "sha512-yynBb1g+RFUPY64fTrFv7nsjRrENBQJaX2UL+2Szc9REFrSNm1rpSXHGzhmAy7a9uv3vlvgBlXnf9RqmPH1/DA==" - }, - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "requires": { - "jsonify": "~0.0.0" - } - }, - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" - }, - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" - }, - "long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, - "lru-cache": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.4.tgz", - "integrity": "sha512-EPstzZ23znHUVLKj+lcXO1KvZkrlw+ZirdwvOmnAnA/1PB4ggyXJ77LRkCqkff+ShQ+cqoxCxLQOh4cKITO5iA==", - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^3.0.2" - } - }, - "media-typer": { - "version": "0.3.0", - "resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" - }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" - }, - "mime": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" - }, - "mime-db": { - "version": "1.37.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz", - "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==" - }, - "mime-types": { - "version": "2.1.21", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", - "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", - "requires": { - "mime-db": "~1.37.0" - } - }, - "moment": { - "version": "2.22.2", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz", - "integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=" - }, - "moment-timezone": { - "version": "0.5.23", - "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.23.tgz", - "integrity": "sha512-WHFH85DkCfiNMDX5D3X7hpNH3/PUhjTGcD0U1SgfBGZxJ3qUmJh5FdvaFjcClxOvB3rzdfj4oRffbI38jEnC1w==", - "requires": { - "moment": ">= 2.9.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "negotiator": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", - "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" - }, - "node-fetch": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.3.0.tgz", - "integrity": "sha512-MOd8pV3fxENbryESLgVIeaGKrdl+uaYhCSSVkjeOb/31/njTpcis5aWfdqgNlHIrKOLRbMnfPINPOML2CIFeXA==" - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - }, - "object-keys": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", - "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==" - }, - "object-path": { - "version": "0.11.4", - "resolved": "https://registry.npmjs.org/object-path/-/object-path-0.11.4.tgz", - "integrity": "sha1-NwrnUvvzfePqcKhhwju6iRVpGUk=" - }, - "object.getownpropertydescriptors": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", - "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", - "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.5.1" - } - }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "requires": { - "ee-first": "1.1.1" - } - }, - "packet-reader": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-0.3.1.tgz", - "integrity": "sha1-zWLmCvjX/qinBexP+ZCHHEaHHyc=" - }, - "parseurl": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", - "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" - }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" - }, - "pg": { - "version": "7.6.1", - "resolved": "https://registry.npmjs.org/pg/-/pg-7.6.1.tgz", - "integrity": "sha512-rAItIkYrRaNGinZN/Hs8F9R5mQjQSPlnzxPF+eCimSl92qnuNGR42gkpOQKP1bnvTwkSjRTBL+VNC5EcFhtCuQ==", - "requires": { - "buffer-writer": "2.0.0", - "packet-reader": "0.3.1", - "pg-connection-string": "0.1.3", - "pg-pool": "~2.0.3", - "pg-types": "~1.12.1", - "pgpass": "1.x", - "semver": "4.3.2" - } - }, - "pg-connection-string": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-0.1.3.tgz", - "integrity": "sha1-2hhHsglA5C7hSSvq9l1J2RskXfc=" - }, - "pg-hstore": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/pg-hstore/-/pg-hstore-2.3.2.tgz", - "integrity": "sha1-9+8FPnubiSrphq8vfL6GQy388k8=", - "requires": { - "underscore": "^1.7.0" - } - }, - "pg-pool": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-2.0.4.tgz", - "integrity": "sha512-Mi2AsmlFkVMpI28NreaDkz5DkfxLOG16C/HNwi091LDlOiDiQACtAroLxSd1vIS2imBqxdjjO9cQZg2CwsOPbw==" - }, - "pg-types": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-1.12.1.tgz", - "integrity": "sha1-1kCH45A7WP+q0nnnWVxSIIoUw9I=", - "requires": { - "postgres-array": "~1.0.0", - "postgres-bytea": "~1.0.0", - "postgres-date": "~1.0.0", - "postgres-interval": "^1.1.0" - } - }, - "pgpass": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.2.tgz", - "integrity": "sha1-Knu0G2BltnkH6R2hsHwYR8h3swY=", - "requires": { - "split": "^1.0.0" - } - }, - "postgres-array": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-1.0.3.tgz", - "integrity": "sha512-5wClXrAP0+78mcsNX3/ithQ5exKvCyK5lr5NEEEeGwwM6NJdQgzIJBVxLvRW+huFpX92F2QnZ5CcokH0VhK2qQ==" - }, - "postgres-bytea": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz", - "integrity": "sha1-AntTPAqokOJtFy1Hz5zOzFIazTU=" - }, - "postgres-date": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.3.tgz", - "integrity": "sha1-4tiXAu/bJY/52c7g/pG9BpdSV6g=" - }, - "postgres-interval": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.1.2.tgz", - "integrity": "sha512-fC3xNHeTskCxL1dC8KOtxXt7YeFmlbTYtn7ul8MkVERuTmf7pI4DrkAxcw3kh1fQ9uz4wQmd03a1mRiXUZChfQ==", - "requires": { - "xtend": "^4.0.0" - } - }, - "protobufjs": { - "version": "6.8.8", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.8.tgz", - "integrity": "sha512-AAmHtD5pXgZfi7GMpllpO3q1Xw1OYldr+dMUlAnffGTAhqkg72WdmSY71uKBF/JuyiKs8psYbtKrhi0ASCD8qw==", - "requires": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/long": "^4.0.0", - "@types/node": "^10.1.0", - "long": "^4.0.0" - } - }, - "proxy-addr": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", - "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", - "requires": { - "forwarded": "~0.1.2", - "ipaddr.js": "1.8.0" - } - }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" - }, - "range-parser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", - "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" - }, - "raw-body": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", - "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", - "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.3", - "iconv-lite": "0.4.23", - "unpipe": "1.0.0" - } - }, - "readable-stream": { - "version": "1.1.14", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "regenerator-runtime": { - "version": "0.12.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz", - "integrity": "sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg==" - }, - "retry": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", - "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=" - }, - "retry-as-promised": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/retry-as-promised/-/retry-as-promised-2.3.2.tgz", - "integrity": "sha1-zZdO5P2bX+A8vzGHHuSCIcB3N7c=", - "requires": { - "bluebird": "^3.4.6", - "debug": "^2.6.9" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "semver": { - "version": "4.3.2", - "resolved": "http://registry.npmjs.org/semver/-/semver-4.3.2.tgz", - "integrity": "sha1-x6BxWKgL7dBSNVt3DYLWZA+AO+c=" - }, - "send": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", - "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", - "requires": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "~1.6.2", - "mime": "1.4.1", - "ms": "2.0.0", - "on-finished": "~2.3.0", - "range-parser": "~1.2.0", - "statuses": "~1.4.0" - }, - "dependencies": { - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "sequelize": { - "version": "4.41.2", - "resolved": "https://registry.npmjs.org/sequelize/-/sequelize-4.41.2.tgz", - "integrity": "sha512-8vPf2R0o9iEmtzkqNzwFdblO+0Mu+RNxOdLeYGGqWGlp3cushLpQucAeSGPQgf2hQVZP5yOCM1ouZKTQ5FTlvA==", - "requires": { - "bluebird": "^3.5.0", - "cls-bluebird": "^2.1.0", - "debug": "^3.1.0", - "depd": "^1.1.0", - "dottie": "^2.0.0", - "generic-pool": "^3.4.0", - "inflection": "1.12.0", - "lodash": "^4.17.1", - "moment": "^2.20.0", - "moment-timezone": "^0.5.14", - "retry-as-promised": "^2.3.2", - "semver": "^5.5.0", - "terraformer-wkt-parser": "^1.1.2", - "toposort-class": "^1.0.1", - "uuid": "^3.2.1", - "validator": "^10.4.0", - "wkx": "^0.4.1" - }, - "dependencies": { - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" - }, - "semver": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", - "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" - } - } - }, - "serve-static": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", - "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.2", - "send": "0.16.2" - } - }, - "setprototypeof": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" - }, - "shimmer": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shimmer/-/shimmer-1.2.0.tgz", - "integrity": "sha512-xTCx2vohXC2EWWDqY/zb4+5Mu28D+HYNSOuFzsyRDRvI/e1ICb69afwaUwfjr+25ZXldbOLyp+iDUZHq8UnTag==" - }, - "split": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", - "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", - "requires": { - "through": "2" - } - }, - "statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" - }, - "streamsearch": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz", - "integrity": "sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo=" - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - }, - "subscriptions-transport-ws": { - "version": "0.9.15", - "resolved": "https://registry.npmjs.org/subscriptions-transport-ws/-/subscriptions-transport-ws-0.9.15.tgz", - "integrity": "sha512-f9eBfWdHsePQV67QIX+VRhf++dn1adyC/PZHP6XI5AfKnZ4n0FW+v5omxwdHVpd4xq2ZijaHEcmlQrhBY79ZWQ==", - "requires": { - "backo2": "^1.0.2", - "eventemitter3": "^3.1.0", - "iterall": "^1.2.1", - "symbol-observable": "^1.0.4", - "ws": "^5.2.0" - }, - "dependencies": { - "ws": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", - "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==", - "requires": { - "async-limiter": "~1.0.0" - } - } - } - }, - "symbol-observable": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", - "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==" - }, - "terraformer": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/terraformer/-/terraformer-1.0.9.tgz", - "integrity": "sha512-YlmQ1fsMWTkKGDGibCRWgmLzrpDRUr63Q025LJ/taYQ6j1Yb8q9McKF7NBi6ACAyUXO6F/bl9w6v4MY307y5Ag==", - "requires": { - "@types/geojson": "^1.0.0" - } - }, - "terraformer-wkt-parser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/terraformer-wkt-parser/-/terraformer-wkt-parser-1.2.0.tgz", - "integrity": "sha512-QU3iA54St5lF8Za1jg1oj4NYc8sn5tCZ08aNSWDeGzrsaV48eZk1iAVWasxhNspYBoCqdHuoot1pUTUrE1AJ4w==", - "requires": { - "@types/geojson": "^1.0.0", - "terraformer": "~1.0.5" - } - }, - "through": { - "version": "2.3.8", - "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" - }, - "toposort-class": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toposort-class/-/toposort-class-1.0.1.tgz", - "integrity": "sha1-f/0feMi+KMO6Rc1OGj9e4ZO9mYg=" - }, - "type-is": { - "version": "1.6.16", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", - "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.18" - } - }, - "underscore": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", - "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" - }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" - }, - "util.promisify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", - "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", - "requires": { - "define-properties": "^1.1.2", - "object.getownpropertydescriptors": "^2.0.3" - } - }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" - }, - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" - }, - "validator": { - "version": "10.9.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-10.9.0.tgz", - "integrity": "sha512-hZJcZSWz9poXBlAkjjcsNAdrZ6JbjD3kWlNjq/+vE7RLLS/+8PAj3qVVwrwsOz/WL8jPmZ1hYkRvtlUeZAm4ug==" - }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" - }, - "wkx": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/wkx/-/wkx-0.4.5.tgz", - "integrity": "sha512-01dloEcJZAJabLO5XdcRgqdKpmnxS0zIT02LhkdWOZX2Zs2tPM6hlZ4XG9tWaWur1Qd1OO4kJxUbe2+5BofvnA==", - "requires": { - "@types/node": "*" - } - }, - "ws": { - "version": "6.1.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-6.1.2.tgz", - "integrity": "sha512-rfUqzvz0WxmSXtJpPMX2EeASXabOrSMk1ruMOV3JBTBjo4ac2lDjGGsbQSyxj8Odhw5fBib8ZKEjDNvgouNKYw==", - "requires": { - "async-limiter": "~1.0.0" - } - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" - }, - "yallist": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", - "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==" - }, - "zen-observable": { - "version": "0.8.11", - "resolved": "https://registry.npmjs.org/zen-observable/-/zen-observable-0.8.11.tgz", - "integrity": "sha512-N3xXQVr4L61rZvGMpWe8XoCGX8vhU35dPyQ4fm5CY/KDlG0F75un14hjbckPXTDuKUY6V0dqR2giT6xN8Y4GEQ==" - }, - "zen-observable-ts": { - "version": "0.8.11", - "resolved": "https://registry.npmjs.org/zen-observable-ts/-/zen-observable-ts-0.8.11.tgz", - "integrity": "sha512-8bs7rgGV4kz5iTb9isudkuQjtWwPnQ8lXq6/T76vrepYZVMsDEv6BXaEA+DHdJSK3KVLduagi9jSpSAJ5NgKHw==", - "requires": { - "zen-observable": "^0.8.0" - } - } - } -} diff --git a/community/boilerplates/remote-schemas/aws-lambda/nodejs/index.js b/community/boilerplates/remote-schemas/aws-lambda/nodejs/index.js new file mode 100644 index 00000000000..fb9af887621 --- /dev/null +++ b/community/boilerplates/remote-schemas/aws-lambda/nodejs/index.js @@ -0,0 +1,16 @@ +const gql = require('graphql-tag'); + +const typeDefs = gql` + type Query { + hello: String + } +`; + +const resolvers = { + Query: { + hello: () => "world", + }, +}; + +exports.typeDefs = typeDefs; +exports.resolvers = resolvers; diff --git a/community/boilerplates/remote-schemas/aws-lambda/nodejs/lambdaCtx.js b/community/boilerplates/remote-schemas/aws-lambda/nodejs/lambdaCtx.js new file mode 100644 index 00000000000..154abe02f70 --- /dev/null +++ b/community/boilerplates/remote-schemas/aws-lambda/nodejs/lambdaCtx.js @@ -0,0 +1,22 @@ +const ApolloServerLambda = require('apollo-server-lambda').ApolloServer; +const { typeDefs, resolvers } = require('./index'); + +const server = new ApolloServerLambda({ + typeDefs, + resolvers, + context: ({ event, context }) => ({ + headers: event.headers, + functionName: context.functionName, + event, + context, + }), +}); + +exports.handler = server.createHandler({ + cors: { + origin: '*', + credentials: true, + allowedHeaders: 'Content-Type, Authorization' + }, +}); + diff --git a/community/boilerplates/remote-schemas/aws-lambda/nodejs/localDev.js b/community/boilerplates/remote-schemas/aws-lambda/nodejs/localDev.js new file mode 100644 index 00000000000..c0a857c8e6b --- /dev/null +++ b/community/boilerplates/remote-schemas/aws-lambda/nodejs/localDev.js @@ -0,0 +1,11 @@ +const { ApolloServer } = require('apollo-server'); +const express = require('express'); +const app = express(); + +const { typeDefs, resolvers } = require('./index'); + +const helloSchema = new ApolloServer({ typeDefs, resolvers }); + +helloSchema.listen().then(({ url }) => { + console.log(`schema ready at ${url}`); +}); diff --git a/community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/package.json b/community/boilerplates/remote-schemas/aws-lambda/nodejs/package.json similarity index 69% rename from community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/package.json rename to community/boilerplates/remote-schemas/aws-lambda/nodejs/package.json index 000f0831b42..1dc30dc5309 100644 --- a/community/boilerplates/remote-schemas/aws-lambda/nodejs/apollo-sequelize/package.json +++ b/community/boilerplates/remote-schemas/aws-lambda/nodejs/package.json @@ -2,7 +2,7 @@ "name": "aws-lambda-nodejs", "version": "1.0.0", "description": "", - "main": "graphql.js", + "main": "lambdaCtx.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, @@ -10,11 +10,8 @@ "author": "", "license": "ISC", "dependencies": { - "apollo-server": "^2.2.2", "apollo-server-lambda": "^2.1.0", "graphql": "^0.13.1", - "pg": "^7.6.0", - "pg-hstore": "^2.3.2", - "sequelize": "^4.41.0" + "graphql-tag": "^2.10.1" } } diff --git a/community/boilerplates/remote-schemas/azure-functions/nodejs/.gitignore b/community/boilerplates/remote-schemas/azure-functions/nodejs/.gitignore new file mode 100644 index 00000000000..3b776d7f9e6 --- /dev/null +++ b/community/boilerplates/remote-schemas/azure-functions/nodejs/.gitignore @@ -0,0 +1,3 @@ +node_modules/ +*.zip +package-lock.json diff --git a/community/boilerplates/remote-schemas/azure-functions/nodejs/README.md b/community/boilerplates/remote-schemas/azure-functions/nodejs/README.md new file mode 100644 index 00000000000..01281ecd69c --- /dev/null +++ b/community/boilerplates/remote-schemas/azure-functions/nodejs/README.md @@ -0,0 +1,83 @@ +# Azure Functions + NodeJS + Apollo + +This is a GraphQL backend boilerplate in nodejs that can be deployed on Azure Functions. + +## Stack + +node 8.10 + +Azure Functions + +#### Frameworks/Libraries + +Apollo Server (GraphQL framework) + +## Schema + + +``` +type Query { + hello: String +} +``` + +## Local Development + +The sample source code is present in `graphql` folder. + +```bash +$ git clone git@github.com:hasura/graphql-engine +$ cd graphql-engine/community/boilerplates/remote-schemas/azure-functions/nodejs +``` + +Start a local development server (you may need to install dependencies from npm): + +```bash +$ cd graphql +$ npm i --no-save apollo-server express +$ node localDev.js + +Output: + +Server ready at http://localhost:4000/ +``` + +This will start a local server on `localhost:4000`. You can hit the graphql service at `localhost:4000`. This opens a graphql playground where you can query your schema. + +## Deployment + +1. Install `az` cli. + +2. Create a zip of all resources (from the current directory): + +```bash +$ zip -r graphql.zip * +``` + +2. Run the following commands to deploy: + +```bash +$ az group create --name 'my-functions-group' --location southindia + +$ az storage account create --name 'myfunctionsstorage' --location southindia --resource-group 'my-functions-group' --sku Standard_LRS + +$ az functionapp create --name 'hello-graphql' --storage-account 'myfunctionsstorage' --resource-group 'my-functions-group' --consumption-plan-location southindia + +$ az functionapp deployment source config-zip -g "my-functions-group" -n "hello-graphql" --src graphql.zip + +``` + +4. Get the HTTP Url: + +```bash +$ az functionapp show -g "my-functions-group" -n "hello-graphql" +``` +Output: +```json + "hostNames": [ + "hello-graphql.azurewebsites.net" + ], +``` + +The url of the function is \/\ e.g. in our case: `https://hello-graphql.azurewebsites.net/graphql` + diff --git a/community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/.gitignore b/community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/.gitignore new file mode 100644 index 00000000000..3b776d7f9e6 --- /dev/null +++ b/community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/.gitignore @@ -0,0 +1,3 @@ +node_modules/ +*.zip +package-lock.json diff --git a/community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/function.json b/community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/function.json new file mode 100644 index 00000000000..de247784533 --- /dev/null +++ b/community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/function.json @@ -0,0 +1,20 @@ +{ + "disabled": false, + "bindings": [ + { + "authLevel": "anonymous", + "type": "httpTrigger", + "direction": "in", + "name": "req", + "methods": [ + "get", + "post" + ] + }, + { + "type": "http", + "direction": "out", + "name": "$return" + } + ] +} diff --git a/community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/localDev.js b/community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/localDev.js new file mode 100644 index 00000000000..34db8e2cc42 --- /dev/null +++ b/community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/localDev.js @@ -0,0 +1,11 @@ +const { ApolloServer } = require('apollo-server'); +const express = require('express'); +const app = express(); + +const { typeDefs, resolvers } = require('./server'); + +const helloSchema = new ApolloServer({ typeDefs, resolvers }); + +helloSchema.listen().then(({ url }) => { + console.log(`schema ready at ${url}`); +}); diff --git a/community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/package.json b/community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/package.json new file mode 100644 index 00000000000..e9cadabda8e --- /dev/null +++ b/community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/package.json @@ -0,0 +1,17 @@ +{ + "name": "azure-functions-nodejs", + "version": "1.0.0", + "description": "", + "main": "run.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "apollo-server-azure-functions": "^2.4.8", + "graphql": "^0.13.1", + "graphql-tag": "^2.10.1" + } +} diff --git a/community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/run.js b/community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/run.js new file mode 100644 index 00000000000..50536cbdc2a --- /dev/null +++ b/community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/run.js @@ -0,0 +1,16 @@ +const { ApolloServer } = require("apollo-server-azure-functions"); +const { typeDefs, resolvers } = require('./server'); + +const server = new ApolloServer({ + typeDefs, + resolvers, +}); + +module.exports = server.createHandler({ + cors: { + origin: '*', + credentials: true, + allowedHeaders: 'Content-Type, Authorization' + }, +}); + diff --git a/community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/server.js b/community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/server.js new file mode 100644 index 00000000000..fb9af887621 --- /dev/null +++ b/community/boilerplates/remote-schemas/azure-functions/nodejs/graphql/server.js @@ -0,0 +1,16 @@ +const gql = require('graphql-tag'); + +const typeDefs = gql` + type Query { + hello: String + } +`; + +const resolvers = { + Query: { + hello: () => "world", + }, +}; + +exports.typeDefs = typeDefs; +exports.resolvers = resolvers; diff --git a/community/boilerplates/remote-schemas/azure-functions/nodejs/host.json b/community/boilerplates/remote-schemas/azure-functions/nodejs/host.json new file mode 100644 index 00000000000..0bf3536f1e5 --- /dev/null +++ b/community/boilerplates/remote-schemas/azure-functions/nodejs/host.json @@ -0,0 +1,19 @@ +{ + "version": "2.0", + "functions": [ "graphql" ], + "functionTimeout": "00:00:30", + "extensions": { + "http": { + "routePrefix": "" + } + }, + "logging": { + "fileLoggingMode": "always", + "logLevel": { + "default": "Information" + }, + "console": { + "isEnabled": "false" + } + } +} diff --git a/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/.gcloudignore b/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/.gcloudignore new file mode 100644 index 00000000000..481bd2698a5 --- /dev/null +++ b/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/.gcloudignore @@ -0,0 +1,17 @@ +# This file specifies files that are *not* uploaded to Google Cloud Platform +# using gcloud. It follows the same syntax as .gitignore, with the addition of +# "#!include" directives (which insert the entries of the given .gitignore-style +# file at that point). +# +# For more information, run: +# $ gcloud topic gcloudignore +# +.gcloudignore +# If you would like to upload your .git directory, .gitignore file or files +# from your .gitignore file, remove the corresponding line +# below: +.git +.gitignore + +node_modules +#!include:.gitignore diff --git a/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/.gitignore b/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/.gitignore new file mode 100644 index 00000000000..3b776d7f9e6 --- /dev/null +++ b/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/.gitignore @@ -0,0 +1,3 @@ +node_modules/ +*.zip +package-lock.json diff --git a/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/README.md b/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/README.md new file mode 100644 index 00000000000..733543691f9 --- /dev/null +++ b/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/README.md @@ -0,0 +1,62 @@ +# Google Cloud Functions + NodeJS + Apollo + +This is a GraphQL backend boilerplate in nodejs that can be deployed on Google Cloud Functions. + +## Stack + +node 8.10 + +Google Cloud Functions + +#### Frameworks/Libraries + +Apollo Server (GraphQL framework) + +## Schema + + +``` +type Query { + hello: String +} +``` + +## Local Development + +The sample source code is present in `index.js`. + +```bash +$ git clone git@github.com:hasura/graphql-engine +$ cd graphql-engine/community/boilerplates/remote-schemas/google-cloud-functions/nodejs +``` + +Start a local development server (you may need to install dependencies from npm): + +```bash +$ npm i --no-save apollo-server express +$ node localDev.js + +Output: + +Server ready at http://localhost:4000/ +``` + +This will start a local server on `localhost:4000`. You can hit the graphql service at `localhost:4000`. This opens a graphql playground where you can query your schema. + +## Deployment + +1. Install `gcloud` cli. + +2. From the current directory, run the following command to deploy the function: + +```bash +$ gcloud functions deploy hello-graphql --entry-point handler --runtime nodejs8 --trigger-http +``` + +3. Get the trigger URL from the above output: + +```yaml +httpsTrigger: + url: https://us-central1-hasura-test.cloudfunctions.net/hello-graphql +``` + diff --git a/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/googleCtx.js b/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/googleCtx.js new file mode 100644 index 00000000000..e523568b0c3 --- /dev/null +++ b/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/googleCtx.js @@ -0,0 +1,23 @@ +const { ApolloServer } = require("apollo-server-cloud-functions"); +const { typeDefs, resolvers } = require('./index'); + +const server = new ApolloServer({ + typeDefs, + resolvers, + playground: true, + introspection: true, + context: ({ req, res }) => ({ + headers: req.headers, + req, + res, + }), +}); + +exports.handler = server.createHandler({ + cors: { + origin: '*', + credentials: true, + allowedHeaders: 'Content-Type, Authorization' + }, +}); + diff --git a/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/index.js b/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/index.js new file mode 100644 index 00000000000..fb9af887621 --- /dev/null +++ b/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/index.js @@ -0,0 +1,16 @@ +const gql = require('graphql-tag'); + +const typeDefs = gql` + type Query { + hello: String + } +`; + +const resolvers = { + Query: { + hello: () => "world", + }, +}; + +exports.typeDefs = typeDefs; +exports.resolvers = resolvers; diff --git a/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/localDev.js b/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/localDev.js new file mode 100644 index 00000000000..c0a857c8e6b --- /dev/null +++ b/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/localDev.js @@ -0,0 +1,11 @@ +const { ApolloServer } = require('apollo-server'); +const express = require('express'); +const app = express(); + +const { typeDefs, resolvers } = require('./index'); + +const helloSchema = new ApolloServer({ typeDefs, resolvers }); + +helloSchema.listen().then(({ url }) => { + console.log(`schema ready at ${url}`); +}); diff --git a/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/package.json b/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/package.json new file mode 100644 index 00000000000..9a98fdfdf20 --- /dev/null +++ b/community/boilerplates/remote-schemas/google-cloud-functions/nodejs/package.json @@ -0,0 +1,17 @@ +{ + "name": "google-cloud-functions-nodejs", + "version": "1.0.0", + "description": "", + "main": "googleCtx.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "apollo-server-cloud-functions": "^2.4.8", + "graphql": "^0.13.1", + "graphql-tag": "^2.10.1" + } +} diff --git a/community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/.gitignore b/community/boilerplates/remote-schemas/zeit-now/nodejs/.gitignore similarity index 100% rename from community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/.gitignore rename to community/boilerplates/remote-schemas/zeit-now/nodejs/.gitignore diff --git a/community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/Dockerfile b/community/boilerplates/remote-schemas/zeit-now/nodejs/Dockerfile similarity index 100% rename from community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/Dockerfile rename to community/boilerplates/remote-schemas/zeit-now/nodejs/Dockerfile diff --git a/community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/README.md b/community/boilerplates/remote-schemas/zeit-now/nodejs/README.md similarity index 50% rename from community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/README.md rename to community/boilerplates/remote-schemas/zeit-now/nodejs/README.md index 132f6c1ca37..d9939420c96 100644 --- a/community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/README.md +++ b/community/boilerplates/remote-schemas/zeit-now/nodejs/README.md @@ -1,43 +1,27 @@ -# Zeit + NodeJS + Apollo + Sequelize GraphQL boilerplate +# Zeit (1.0) + NodeJS + Apollo -A boilerplate using nodejs and [Apollo Server](https://www.apollographql.com/docs/apollo-server/) that can be deployed on Zeit. +A boilerplate using Nodejs and [Apollo Server](https://www.apollographql.com/docs/apollo-server/) that can be deployed on Zeit. ## Stack node 8.10 -Postgres - -Zeit Now +Zeit 1.0 #### Frameworks/Libraries Apollo Server (GraphQL framework) -Sequelize (Postgres ORM) - ## Local Development -The sample source code is present in `server.js`. Clone the repo and go to `community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize` folder: +The sample source code is present in `server.js`. ```bash $ git clone git@github.com:hasura/graphql-engine -$ cd graphql-engine/community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize +$ cd graphql-engine/community/boilerplates/remote-schemas/zeit-now/nodejs ``` -1) First, let's set the environment variable for connecting to the postgres instance. This can be a local postgres instance or some managed postgres instance like AWS RDS. - -```bash -$ export POSTGRES_CONNECTION_STRING='postgres://username:password@rds-database-endpoint.us-east-1.rds.amazonaws.com:5432/mydb' -``` - -2) Next, lets create the tables required for our schema. - -```bash -psql $POSTGRES_CONNECTION_STRING -c "create table users(id serial primary key, name text, balance integer); create table min_amount(amount integer); insert into min_amount values (100)" -``` - -3) Now, you can run the server locally: +Run the server locally: ```bash npm install diff --git a/community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/models.js b/community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/models.js deleted file mode 100644 index b4652e9b846..00000000000 --- a/community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/models.js +++ /dev/null @@ -1,37 +0,0 @@ -const Sequelize = require("sequelize"); - -const POSTGRES_CONNECTION_STRING = process.env.POSTGRES_CONNECTION_STRING || "postgres://postgres:password@localhost:6432/postgres"; - -const sequelize = new Sequelize( - POSTGRES_CONNECTION_STRING, {} -); - -const User = sequelize.define( - 'user', - { - id: { type: Sequelize.INTEGER, autoIncrement: true, primaryKey: true }, - name: Sequelize.TEXT, - balance: Sequelize.INTEGER - }, - { - timestamps: false - } -); - -const MinAmount = sequelize.define( - 'min_amount', - { - amount: Sequelize.INTEGER - }, - { - freezeTableName: true, - timestamps: false - } -); - -MinAmount.removeAttribute('id'); - -exports.sequelize = sequelize; -exports.User = User; -exports.MinAmount = MinAmount; - diff --git a/community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/server.js b/community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/server.js deleted file mode 100644 index d3277f1bf40..00000000000 --- a/community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/server.js +++ /dev/null @@ -1,71 +0,0 @@ -const { ApolloServer } = require('apollo-server'); -const { makeExecutableSchema } = require('graphql-tools'); -const Sequelize = require("sequelize"); -const {User, MinAmount, sequelize} = require('./models.js'); - -const port = process.env.PORT || 4000; - -const typeDefs = ` - type Query { - hello: String - } - - type Mutation { - validateAndAddUser(name: String, balance: Int): User - } - - type User { - id: Int - name: String - balance: Int - } -`; - -// We consider a user schema where a user can be added only if a custom validation passes. -// The custom validation involves fetching a min amount from a table -// and checking if the user balance is greater than the min amount. -// This will be done in a transaction. - -const resolvers = { - Query: { - hello: () => "world", - }, - Mutation: { - validateAndAddUser: async (_, { name, balance }) => { - //begin transaction - return await sequelize.transaction(async (t) => { - try { - //fetch min amount - const minAmount = await MinAmount.findOne({}, {transaction: t}); - //check balance - if (balance >= minAmount.amount) { - //create user if balance is greater - const user = await User.create({ - name: name, - balance: balance - }); - return user; - } else { - throw new Error("balance too low, required atleast " + minAmount.amount); - } - } catch (e) { - console.log(e); - throw new Error(e); - } - }); - } - } -}; - -const schema = makeExecutableSchema({ - typeDefs, - resolvers -}); - -const server = new ApolloServer({ - schema -}); - -server.listen({ port }).then(({url}) => { - console.log(`GraphQL server running at ${url}`); -}); diff --git a/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/.gitignore b/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/.gitignore deleted file mode 100644 index d5f19d89b30..00000000000 --- a/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -package-lock.json diff --git a/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/Dockerfile b/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/Dockerfile deleted file mode 100644 index 7618a4ef808..00000000000 --- a/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM node:8 - -WORKDIR /server - -COPY ./package.json /server/ - -RUN npm install - -COPY . /server/ - -CMD ["npm", "start"] diff --git a/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/README.md b/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/README.md deleted file mode 100644 index 337b32b1aa1..00000000000 --- a/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# Zeit + NodeJS + Express + GraphQL.js + Sequelize GraphQL boilerplate - -A boilerplate using nodejs, express and [GraphQL.js](https://graphql.github.io/graphql-js/running-an-express-graphql-server/) that can be deployed on Zeit. - -## Stack - -node 8.10 - -Postgres - -Zeit Now - -#### Frameworks/Libraries - -Express (NodeJS framework) - -GraphQL.js (GraphQL framework) - -Sequelize (Postgres ORM) - -## Local Development - -The sample source code is present in `server.js`. Clone the repo and go to `community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize` folder: - -```bash -$ git clone git@github.com:hasura/graphql-engine -$ cd graphql-engine/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize -``` - -1) First, let's set the environment variable for connecting to the postgres instance. This can be a local postgres instance or some managed postgres instance like AWS RDS. - -```bash -$ export POSTGRES_CONNECTION_STRING='postgres://username:password@rds-database-endpoint.us-east-1.rds.amazonaws.com:5432/mydb' -``` - -2) Next, lets create the tables required for our schema. - -```bash -psql $POSTGRES_CONNECTION_STRING -c "create table users(id serial primary key, name text, balance integer); create table min_amount(amount integer); insert into min_amount values (100)" -``` - -3) Now, you can run the server locally: - -```bash -npm install -npm start -``` - -Running the server using Docker: - -```bash -docker build -t graphql . -docker run -p 4000:4000 graphql -``` - -This will start a local server on `localhost:4000`. You can hit the graphql service at `localhost:4000/graphql` which opens GraphiQL. - -## Deployment - -Install the [Zeit Now](https://zeit.co/now) CLI: - -```bash -npm install -g now -``` - -Deploy the server: -```bash -now -``` - -Get the URL and make a sample query: -```bash -curl https://app-name-something.now.sh/graphql \ - -H 'Content-Type:application/json' \ - -d'{"query":"{ hello }"}' - -{"data":{"hello":"Hello World!"}} -``` - -You can also visit the now url to open GraphiQL. diff --git a/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/models.js b/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/models.js deleted file mode 100644 index b4652e9b846..00000000000 --- a/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/models.js +++ /dev/null @@ -1,37 +0,0 @@ -const Sequelize = require("sequelize"); - -const POSTGRES_CONNECTION_STRING = process.env.POSTGRES_CONNECTION_STRING || "postgres://postgres:password@localhost:6432/postgres"; - -const sequelize = new Sequelize( - POSTGRES_CONNECTION_STRING, {} -); - -const User = sequelize.define( - 'user', - { - id: { type: Sequelize.INTEGER, autoIncrement: true, primaryKey: true }, - name: Sequelize.TEXT, - balance: Sequelize.INTEGER - }, - { - timestamps: false - } -); - -const MinAmount = sequelize.define( - 'min_amount', - { - amount: Sequelize.INTEGER - }, - { - freezeTableName: true, - timestamps: false - } -); - -MinAmount.removeAttribute('id'); - -exports.sequelize = sequelize; -exports.User = User; -exports.MinAmount = MinAmount; - diff --git a/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/now.json b/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/now.json deleted file mode 100644 index 463052dd383..00000000000 --- a/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/now.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": 1 -} diff --git a/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/package.json b/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/package.json deleted file mode 100644 index 9ae4af0281f..00000000000 --- a/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "nodejs-express-gql-server", - "version": "1.0.0", - "description": "A GraphQL server boilerplate for NodeJS-Express using graphql-js library", - "main": "server.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "start": "node -r esm server.js" - }, - "author": "Hasura", - "license": "MIT", - "dependencies": { - "express": "^4.16.4", - "express-graphql": "^0.7.1", - "graphql": "^14.0.2", - "pg": "^7.7.1", - "sequelize": "^4.42.0" - }, - "devDependencies": { - "esm": "^3.0.84" - } -} diff --git a/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/server.js b/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/server.js deleted file mode 100644 index 518cff79d3d..00000000000 --- a/community/boilerplates/remote-schemas/zeit-now/nodejs/express-graphqljs-sequelize/server.js +++ /dev/null @@ -1,67 +0,0 @@ -const express = require('express'); -const graphqlHTTP = require('express-graphql'); -const { buildSchema } = require('graphql'); -const Sequelize = require("sequelize"); -const {User, MinAmount, sequelize} = require('./models.js'); - -const port = process.env.port || 4000; - -// Construct a schema, using GraphQL schema language -const schema = buildSchema(` - type Query { - hello: String - } - - type Mutation { - validateAndAddUser(name: String, balance: Int): User - } - - type User { - id: Int - name: String - balance: Int - } -`); - -// We consider a user schema where a user can be added only if a custom validation passes. -// The custom validation involves fetching a min amount from a table -// and checking if the user balance is greater than the min amount. -// This will be done in a transaction. - -const root = { - hello: () => { - return 'Hello world!'; - }, - validateAndAddUser: async ({ name, balance }) => { - //begin transaction - return await sequelize.transaction(async (t) => { - try { - //fetch min amount - const minAmount = await MinAmount.findOne({}, {transaction: t}); - //check balance - if (balance >= minAmount.amount) { - //create user if balance is greater - const user = await User.create({ - name: name, - balance: balance - }); - return user; - } else { - throw new Error("balance too low, required atleast " + minAmount.amount); - } - } catch (e) { - console.log(e); - throw new Error(e); - } - }); - } -}; - -var app = express(); -app.use('/graphql', graphqlHTTP({ - schema: schema, - rootValue: root, - graphiql: true, -})); -app.listen(port); -console.log(`Running a GraphQL API server at localhost:${port}/graphql`); diff --git a/community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/now.json b/community/boilerplates/remote-schemas/zeit-now/nodejs/now.json similarity index 100% rename from community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/now.json rename to community/boilerplates/remote-schemas/zeit-now/nodejs/now.json diff --git a/community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/package.json b/community/boilerplates/remote-schemas/zeit-now/nodejs/package.json similarity index 66% rename from community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/package.json rename to community/boilerplates/remote-schemas/zeit-now/nodejs/package.json index d14010548c3..06a30724b48 100644 --- a/community/boilerplates/remote-schemas/zeit-now/nodejs/apollo-sequelize/package.json +++ b/community/boilerplates/remote-schemas/zeit-now/nodejs/package.json @@ -4,18 +4,13 @@ "description": "A GraphQL server boilerplate written in NodeJS using and Apollo Server", "main": "server.js", "scripts": { - "start": "node -r esm server.js" + "start": "node server.js" }, "author": "Hasura", "license": "MIT", "dependencies": { "apollo-server": "^2.2.1", "graphql": "^14.0.2", - "graphql-tools": "^4.0.3", - "pg": "^7.7.1", - "sequelize": "^4.42.0" - }, - "devDependencies": { - "esm": "^3.0.84" + "graphql-tools": "^4.0.3" } } diff --git a/community/boilerplates/remote-schemas/zeit-now/nodejs/server.js b/community/boilerplates/remote-schemas/zeit-now/nodejs/server.js new file mode 100644 index 00000000000..2c9970b7c6b --- /dev/null +++ b/community/boilerplates/remote-schemas/zeit-now/nodejs/server.js @@ -0,0 +1,29 @@ +const { ApolloServer } = require('apollo-server'); +const { makeExecutableSchema } = require('graphql-tools'); + +const port = process.env.PORT || 4000; + +const typeDefs = ` + type Query { + hello: String + } +`; + +const resolvers = { + Query: { + hello: () => "world", + } +}; + +const schema = makeExecutableSchema({ + typeDefs, + resolvers +}); + +const server = new ApolloServer({ + schema +}); + +server.listen({ port }).then(({url}) => { + console.log(`GraphQL server running at ${url}`); +});