Skip to content

Instantly share code, notes, and snippets.

const monolith_url: string = process.env.APOLLO_URL
const file_manager_url: string = process.env.FILE_MANAGER_URL
async function run() {
// logic on how extract files from file microservice
function getBatchFiles(context) {
return function batchFiles(keys: string[]): Promise<Array<{} | null>> {
return new Promise(function (resolve, reject) {
const query = `
type FileNode {
name: String!
size: Int!
id: Int!
url: String!
}
type MessageNode {
id: Int!
body: String!
files: [FileNode!]
}
type FileNode {
id: Int!
}
const monolith_url: string = process.env.APOLLO_URL
const file_manager_url: string = process.env.FILE_MANAGER_URL
async function run() {
// logic on how extract files from file microservice
function getBatchFiles(context) {
return function batchFiles(keys: string[]): Promise<Array<{} | null>> {
return new Promise(function (resolve, reject) {
// query file microservice here
const monolith_url: string = process.env.APOLLO_URL
const file_manager_url: string = process.env.FILE_MANAGER_URL
async function run() {
// logic on how extract files from file microservice
function getBatchFiles(context) {
return function batchFiles(keys: string[]): Promise<Array<{} | null>> {
return new Promise(function (resolve, reject) {
// query file microservice here
import {ApolloServer} from 'apollo-server'
import {ApolloGateway} from '@apollo/gateway'
const monolith_url: string = 'http://monolith:5000/graphql';
const filemanager_url: string = 'http://filemanager:5000/graphql';
const gateway = new ApolloGateway({
serviceList: [
{ name: 'monolith', url: monolith_url },
{ name: 'filemanager', url: filemanager_url },
],
import graphene
from graphene import ObjectType, Int, String
from graphene_federation import build_schema, key
from utils import file_loader # custom data loader
@key(fields='id')
class FileNode(ObjectType):
id = Int(required=True)
from graphene import ObjectType, Int, List, String, Field, NonNull
from graphene_federation import build_schema, extend, external
@extend(fields='id')
class FileNode(ObjectType):
id = external(Int(required=True))
class MessageNode(ObjectType):
from graphene import Schema, ObjectType, Int, String, List, NonNull
from utils import file_loader # custom data loader
class FileNode(ObjectType):
id = Int(required=True)
url = String(required=True)
@erebus1
erebus1 / stitcher.js
Last active November 8, 2019 13:29
GQL Schema Stitcher
const monolith_url: string = process.env.APOLLO_URL
const file_manager_url: string = process.env.FILE_MANAGER_URL
async function run() {
// logic on how extract files from file microservice
function getBatchFiles(context) {
return function batchFiles(keys: string[]): Promise<Array<{} | null>> {
return new Promise(function (resolve, reject) {
const query = `