- Install dependencies:
yarn
- Start all services and the gateway:
yarn start
Looking for a Schema Stitching example? Check it at https://github.com/nayaabkhan/nexus-stitching-example.
Example of using Apollo Federation and Nexus JS
yarn
yarn start
Looking for a Schema Stitching example? Check it at https://github.com/nayaabkhan/nexus-stitching-example.
Hey thanks a lot for the example!!!
I'm trying to do this with Prisma and it's a bit unclear on some points as I can't find an example that uses a real DB.
I'm trying to connect to an external type. and put it in another type.
For example:
user now contains products. Each is in a separate DB on a separate service.
I can't figure out how to use resolveReference, or even how to resolve the data fetching.
Here's my code:
Schema.ts
onst federatedSchema = applyMiddleware(
transformSchemaFederation(schema, {
Query: {
extend: true,
},
Mutation: {
extend: true,
},
User: {
keyFields: ['id'],
},
Product: {
// extend Product {
extend: true,
// Product @key(fields: "id") {
keyFields: ['id'],
fields: {
id: {
external: true,
},
},
// resolveReference({ id }: any, context: Context, info) {
// return delegateToSchema({
// schema: info.schema,
// operation: 'query',
// fieldName: 'productById',
// args: {
// id,
// },
// context,
// info,
// });
// },
},
}),
permissions
);
Product.ts
import { objectType } from 'nexus';
import { product as TypeName } from './typeNames';
export const User = objectType({
name: TypeName,
definition(t) {
t.string('id');
},
});
User.ts
import { objectType } from 'nexus';
import { user as TypeName, product } from './typeNames';
export const User = objectType({
name: TypeName,
definition(t) {
t.model.id();
t.model.createdAt();
t.model.updatedAt();
t.model.firstName();
t.model.lastName();
t.list.field('products', { type: product }); },
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.