Skip to content

Instantly share code, notes, and snippets.

@josephktcheung
josephktcheung / index.ts
Last active November 3, 2022 02:19
Stitching schema with subscription
import { GraphQLServer, Options } from 'graphql-yoga'
import { mergeSchemas } from 'graphql-tools';
import { getRemoteSchema } from "./remoteSchema";
import { SubscriptionClient } from 'subscriptions-transport-ws';
import * as ws from 'ws';
if (process.env.NODE_ENV !== 'production') {
require('dotenv').config()
}
@josephktcheung
josephktcheung / index.ts
Last active November 19, 2021 20:31
Schema stitching with subscription
import { GraphQLServer, Options } from 'graphql-yoga'
import { mergeSchemas } from 'graphql-tools';
import { getRemoteSchema } from "./remoteSchema";
if (process.env.NODE_ENV !== 'production') {
require('dotenv').config()
}
const start = async () => {
const messageSchema = await getRemoteSchema(process.env.MESSAGE_SERVICE_GRAPHQL_URL, process.env.MESSAGE_SERVICE_SUBSCRIPTION_URL);
@josephktcheung
josephktcheung / handler.ts
Created July 6, 2018 15:50
aws lambda with x-hub
import * as awsServerlessExpress from 'aws-serverless-express';
import * as express from 'express';
import * as xhub from 'express-x-hub';
import * as bodyParser from 'body-parser';
import * as AWS from 'aws-sdk';
import { customDomainReroute } from '@turinggroup/serverless-express-custom-domain-middleware';
const sns = new AWS.SNS();
const app = express();
app.use(