This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {ApolloServer, SyntaxError, UserInputError, AuthenticationError, ForbiddenError} from 'apollo-server-express'; | |
import {GraphQLErrorTrackingExtension} from 'graphql-error-tracking-extension'; | |
import {ErrorReporting} from '@google-cloud/error-reporting'; | |
const errorReporting = new ErrorReporting(); | |
const server = new ApolloServer({ | |
schema, | |
extensions: [() => new GraphQLErrorTrackingExtension({ | |
maskHeaders: ['x-forwarded-for', 'authorization'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
textPayload: "[f85423] {"host":"api.example.org","content-length":"1014","accept":"*/*", | |
"origin":"https://api.example.org","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) | |
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36", | |
"content-type":"application/json","accept-encoding":"gzip, deflate, br", | |
"via":"1.1 google","x-forwarded-for":"***","x-forwarded-proto":"https", | |
"authorization":"***"} | |
timestamp: "2019-02-05T13:24:20Z" | |
} | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mongoexport | |
--host localhost:27017 \ | |
--username xxx \ | |
--authenticationDatabase admin \ | |
--db shop \ | |
--type JSON \ | |
--out ~/project/seeds/ShopItems.json \ | |
--collection ShopItems \ | |
--query '{}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Truncate data in ShopItems collection | |
mongo shop --host localhost:27017 --username xxx --password xxx --authenticationDatabase admin \ | |
--eval 'db.getCollection("ShopItems").remove({})' | |
# Import seed data into ShopItems collection | |
mongoimport --host localhost:27017 --username xxx --password xxx --authenticationDatabase admin \ | |
--db shop --collection ShopItems --type JSON --file ShopItems.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query { | |
shopItems { | |
name | |
category | |
size | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data": { | |
"shopItems": [ | |
{ | |
"name": "Fancy Sneakers", | |
"category": "shoes", | |
"size": "8" | |
}, | |
{ | |
"name": "Black shirt", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as util from 'util'; | |
import * as rp from 'request-promise'; | |
import { exec } from 'child_process'; | |
const pExec = util.promisify(exec); | |
const API = 'http://localhost:4466/'; | |
const CMD_SEED_DATABASE = `${__dirname}/../seed.sh`; | |
describe('Getting shop items', () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Jest Snapshot v1, https://goo.gl/fbAQLP | |
exports[`Getting shop items Retrieves the shop items in default order 1`] = ` | |
Object { | |
"data": Object { | |
"shopItems": Array [ | |
Object { | |
"category": "shoes", | |
"name": "Fancy Sneaker", | |
"size": "8", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { ApolloServer, gql } = require('apollo-server'); | |
const {GraphQLErrorTrackingExtension} = require('graphql-error-tracking-extension'); | |
const {ErrorReporting} = require('@google-cloud/error-reporting'); | |
const errorReporting = new ErrorReporting(); | |
/* | |
* ---------------------------------------- | |
* Let's define some custom errors | |
* ---------------------------------------- | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> docker composer -v | |
Docker version 20.10.8, build 3967b7d |