├── example
├── meals
│ ├── Meals
│ │ ├── routes
│ │ │ └── .gitkeep
│ │ ├── .gitignore
│ │ ├── .dockerignore
│ │ ├── Dockerfile
│ │ ├── app.js
│ │ ├── middlewares
│ │ │ ├── welcome
│ │ │ │ ├── template.txt
│ │ │ │ └── index.js
│ │ │ └── graphql
│ │ │ │ └── index.js
│ │ ├── models
│ │ │ ├── schema_migrations.js
│ │ │ ├── menus.js
│ │ │ ├── menus_products.js
│ │ │ ├── orders_products.js
│ │ │ ├── chef_availabilities.js
│ │ │ ├── ar_internal_metadata.js
│ │ │ ├── orders.js
│ │ │ ├── chefs.js
│ │ │ ├── product_images.js
│ │ │ ├── customers.js
│ │ │ ├── delivery_men.js
│ │ │ ├── products.js
│ │ │ └── index.js
│ │ ├── docker-compose.yml
│ │ ├── package.json
│ │ ├── public
│ │ │ └── favicon.png
│ │ ├── bin
│ │ │ └── www
│ │ └── graphql
│ │ │ ├── menus.js
│ │ │ ├── schema_migrations.js
│ │ │ ├── menus_products.js
│ │ │ ├── orders_products.js
│ │ │ ├── chef_availabilities.js
│ │ │ ├── orders.js
│ │ │ ├── chefs.js
│ │ │ ├── ar_internal_metadata.js
│ │ │ ├── customers.js
│ │ │ ├── product_images.js
│ │ │ ├── delivery_men.js
│ │ │ └── products.js
│ └── docker-compose.yml
├── movies
│ ├── Movies
│ │ ├── routes
│ │ │ └── .gitkeep
│ │ ├── .gitignore
│ │ ├── .dockerignore
│ │ ├── Dockerfile
│ │ ├── app.js
│ │ ├── middlewares
│ │ │ ├── welcome
│ │ │ │ ├── template.txt
│ │ │ │ └── index.js
│ │ │ └── graphql
│ │ │ │ └── index.js
│ │ ├── models
│ │ │ ├── actors.js
│ │ │ ├── genres.js
│ │ │ ├── countries.js
│ │ │ ├── schema_migrations.js
│ │ │ ├── actor_images.js
│ │ │ ├── actors_movies.js
│ │ │ ├── genres_movies.js
│ │ │ ├── countries_movies.js
│ │ │ ├── rentals.js
│ │ │ ├── comments.js
│ │ │ ├── index.js
│ │ │ ├── movies.js
│ │ │ └── customers.js
│ │ ├── docker-compose.yml
│ │ ├── package.json
│ │ ├── public
│ │ │ └── favicon.png
│ │ ├── bin
│ │ │ └── www
│ │ └── graphql
│ │ │ ├── actors.js
│ │ │ ├── genres.js
│ │ │ ├── countries.js
│ │ │ ├── actor_images.js
│ │ │ ├── actors_movies.js
│ │ │ ├── genres_movies.js
│ │ │ ├── schema_migrations.js
│ │ │ ├── countries_movies.js
│ │ │ ├── rentals.js
│ │ │ ├── comments.js
│ │ │ ├── movies.js
│ │ │ └── customers.js
│ └── docker-compose.yml
└── api-gateway
│ ├── package.json
│ ├── index.js
│ └── package-lock.json
├── .gitignore
├── assets
└── logo.png
├── .babelrc
├── package.json
├── LICENSE
├── index.js
└── README.md
/example/meals/Meals/routes/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/example/movies/Movies/routes/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | .env
4 |
--------------------------------------------------------------------------------
/example/meals/Meals/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | .env
4 |
--------------------------------------------------------------------------------
/example/movies/Movies/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | .env
4 |
--------------------------------------------------------------------------------
/example/meals/Meals/.dockerignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | npm-debug.log
3 | .env
4 |
--------------------------------------------------------------------------------
/example/movies/Movies/.dockerignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | npm-debug.log
3 | .env
4 |
--------------------------------------------------------------------------------
/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ForestAdmin/graphql-stitcher/HEAD/assets/logo.png
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [["@babel/preset-env", {
3 | "useBuiltIns": "entry"
4 | }]],
5 | "plugins": [
6 | "@babel/plugin-proposal-class-properties"
7 | ]
8 | }
9 |
--------------------------------------------------------------------------------
/example/meals/Meals/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:10-alpine
2 | RUN apk add --no-cache \
3 | git
4 | WORKDIR /usr/src/app
5 | COPY package*.json ./
6 | RUN npm install
7 | COPY . .
8 | EXPOSE 3004
9 | CMD ["npm", "start"]
10 |
--------------------------------------------------------------------------------
/example/movies/Movies/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:10-alpine
2 | RUN apk add --no-cache \
3 | git
4 | WORKDIR /usr/src/app
5 | COPY package*.json ./
6 | RUN npm install
7 | COPY . .
8 | EXPOSE 3005
9 | CMD ["npm", "start"]
10 |
--------------------------------------------------------------------------------
/example/meals/docker-compose.yml:
--------------------------------------------------------------------------------
1 | postgres :
2 | image : postgres:latest
3 | container_name : meals
4 | ports :
5 | - "5446:5432"
6 | environment:
7 | - POSTGRES_DB=meals
8 | - POSTGRES_USER=forest
9 | - POSTGRES_PASSWORD=secret
10 |
--------------------------------------------------------------------------------
/example/movies/docker-compose.yml:
--------------------------------------------------------------------------------
1 | postgres :
2 | image : postgres:latest
3 | container_name : movies
4 | ports :
5 | - "5445:5432"
6 | environment:
7 | - POSTGRES_DB=movies
8 | - POSTGRES_USER=forest
9 | - POSTGRES_PASSWORD=secret
10 |
--------------------------------------------------------------------------------
/example/meals/Meals/app.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const requireAll = require('require-all');
3 |
4 | const app = express();
5 |
6 | requireAll({
7 | dirname: __dirname + '/middlewares',
8 | recursive: true,
9 | resolve: Module => new Module(app),
10 | });
11 |
12 | module.exports = app;
13 |
--------------------------------------------------------------------------------
/example/meals/Meals/middlewares/welcome/template.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | It works!
4 |
5 |
6 | Installed middlewares
7 | <% _.each(middlewares, (middleware) => { %>
8 | - <%= middleware %>
9 | <% }); %>
10 |
11 |
12 |
--------------------------------------------------------------------------------
/example/movies/Movies/app.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const requireAll = require('require-all');
3 |
4 | const app = express();
5 |
6 | requireAll({
7 | dirname: __dirname + '/middlewares',
8 | recursive: true,
9 | resolve: Module => new Module(app),
10 | });
11 |
12 | module.exports = app;
13 |
--------------------------------------------------------------------------------
/example/movies/Movies/middlewares/welcome/template.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | It works!
4 |
5 |
6 | Installed middlewares
7 | <% _.each(middlewares, (middleware) => { %>
8 | - <%= middleware %>
9 | <% }); %>
10 |
11 |
12 |
--------------------------------------------------------------------------------
/example/meals/Meals/middlewares/graphql/index.js:
--------------------------------------------------------------------------------
1 | const models = require('../../models');
2 |
3 | module.exports = function (app) {
4 | require('lumber-graphql').run(app, {
5 | Sequelize: models.Sequelize,
6 | sequelize: models.sequelize,
7 | modelsDir: __dirname + '/../../models',
8 | schemasDir: __dirname + '/../../graphql',
9 | });
10 | };
11 |
--------------------------------------------------------------------------------
/example/movies/Movies/middlewares/graphql/index.js:
--------------------------------------------------------------------------------
1 | const models = require('../../models');
2 |
3 | module.exports = function (app) {
4 | require('lumber-graphql').run(app, {
5 | Sequelize: models.Sequelize,
6 | sequelize: models.sequelize,
7 | modelsDir: __dirname + '/../../models',
8 | schemasDir: __dirname + '/../../graphql',
9 | });
10 | };
11 |
--------------------------------------------------------------------------------
/example/movies/Movies/models/actors.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('actors', {
3 | 'name': {
4 | type: DataTypes.STRING,
5 | },
6 | }, {
7 | tableName: 'actors',
8 |
9 | timestamps: false,
10 |
11 | });
12 |
13 | Model.associate = (models) => {
14 | };
15 |
16 | return Model;
17 | };
18 |
19 |
--------------------------------------------------------------------------------
/example/movies/Movies/models/genres.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('genres', {
3 | 'genre': {
4 | type: DataTypes.STRING,
5 | },
6 | }, {
7 | tableName: 'genres',
8 |
9 | timestamps: false,
10 |
11 | });
12 |
13 | Model.associate = (models) => {
14 | };
15 |
16 | return Model;
17 | };
18 |
19 |
--------------------------------------------------------------------------------
/example/movies/Movies/models/countries.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('countries', {
3 | 'name': {
4 | type: DataTypes.STRING,
5 | },
6 | }, {
7 | tableName: 'countries',
8 |
9 | timestamps: false,
10 |
11 | });
12 |
13 | Model.associate = (models) => {
14 | };
15 |
16 | return Model;
17 | };
18 |
19 |
--------------------------------------------------------------------------------
/example/movies/Movies/models/schema_migrations.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('schema_migrations', {
3 | 'version': {
4 | type: DataTypes.STRING,
5 | },
6 | }, {
7 | tableName: 'schema_migrations',
8 |
9 | timestamps: false,
10 |
11 | });
12 |
13 | Model.associate = (models) => {
14 | };
15 |
16 | return Model;
17 | };
18 |
19 |
--------------------------------------------------------------------------------
/example/meals/Meals/models/schema_migrations.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('schema_migrations', {
3 | 'version': {
4 | type: DataTypes.STRING,
5 | primaryKey: true
6 | },
7 | }, {
8 | tableName: 'schema_migrations',
9 |
10 | timestamps: false,
11 |
12 | });
13 |
14 | Model.associate = (models) => {
15 | };
16 |
17 | return Model;
18 | };
19 |
20 |
--------------------------------------------------------------------------------
/example/api-gateway/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "api-gateway",
3 | "version": "1.0.0",
4 | "description": "This projects shows how it is easy to implement the concept of GraphQL Schema Stitching using graphql-stitcher.",
5 | "main": "index.js",
6 | "author": "Sandro Munda ",
7 | "license": "MIT",
8 | "dependencies": {
9 | "apollo-server-express": "^2.4.8",
10 | "express": "^4.16.4",
11 | "graphql-stitcher": "beta"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/example/meals/Meals/models/menus.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('menus', {
3 | 'available_at': {
4 | type: DataTypes.DATE,
5 | },
6 | 'chef_id': {
7 | type: DataTypes.INTEGER,
8 | },
9 | }, {
10 | tableName: 'menus',
11 | underscored: true,
12 | timestamps: false,
13 |
14 | });
15 |
16 | Model.associate = (models) => {
17 | };
18 |
19 | return Model;
20 | };
21 |
22 |
--------------------------------------------------------------------------------
/example/movies/Movies/models/actor_images.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('actor_images', {
3 | 'url': {
4 | type: DataTypes.STRING,
5 | },
6 | 'actor_id': {
7 | type: DataTypes.INTEGER,
8 | },
9 | }, {
10 | tableName: 'actor_images',
11 | underscored: true,
12 | timestamps: false,
13 |
14 | });
15 |
16 | Model.associate = (models) => {
17 | };
18 |
19 | return Model;
20 | };
21 |
22 |
--------------------------------------------------------------------------------
/example/movies/Movies/models/actors_movies.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('actors_movies', {
3 | 'movie_id': {
4 | type: DataTypes.INTEGER,
5 | },
6 | 'actor_id': {
7 | type: DataTypes.INTEGER,
8 | },
9 | }, {
10 | tableName: 'actors_movies',
11 | underscored: true,
12 | timestamps: false,
13 |
14 | });
15 |
16 | Model.associate = (models) => {
17 | };
18 |
19 | return Model;
20 | };
21 |
22 |
--------------------------------------------------------------------------------
/example/movies/Movies/models/genres_movies.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('genres_movies', {
3 | 'movie_id': {
4 | type: DataTypes.INTEGER,
5 | },
6 | 'genre_id': {
7 | type: DataTypes.INTEGER,
8 | },
9 | }, {
10 | tableName: 'genres_movies',
11 | underscored: true,
12 | timestamps: false,
13 |
14 | });
15 |
16 | Model.associate = (models) => {
17 | };
18 |
19 | return Model;
20 | };
21 |
22 |
--------------------------------------------------------------------------------
/example/meals/Meals/models/menus_products.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('menus_products', {
3 | 'product_id': {
4 | type: DataTypes.INTEGER,
5 | },
6 | 'menu_id': {
7 | type: DataTypes.INTEGER,
8 | },
9 | }, {
10 | tableName: 'menus_products',
11 | underscored: true,
12 | timestamps: false,
13 |
14 | });
15 |
16 | Model.associate = (models) => {
17 | };
18 |
19 | return Model;
20 | };
21 |
22 |
--------------------------------------------------------------------------------
/example/meals/Meals/models/orders_products.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('orders_products', {
3 | 'order_id': {
4 | type: DataTypes.INTEGER,
5 | },
6 | 'product_id': {
7 | type: DataTypes.INTEGER,
8 | },
9 | }, {
10 | tableName: 'orders_products',
11 | underscored: true,
12 | timestamps: false,
13 |
14 | });
15 |
16 | Model.associate = (models) => {
17 | };
18 |
19 | return Model;
20 | };
21 |
22 |
--------------------------------------------------------------------------------
/example/movies/Movies/models/countries_movies.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('countries_movies', {
3 | 'movie_id': {
4 | type: DataTypes.INTEGER,
5 | },
6 | 'country_id': {
7 | type: DataTypes.INTEGER,
8 | },
9 | }, {
10 | tableName: 'countries_movies',
11 | underscored: true,
12 | timestamps: false,
13 |
14 | });
15 |
16 | Model.associate = (models) => {
17 | };
18 |
19 | return Model;
20 | };
21 |
22 |
--------------------------------------------------------------------------------
/example/meals/Meals/models/chef_availabilities.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('chef_availabilities', {
3 | 'chef_id': {
4 | type: DataTypes.INTEGER,
5 | },
6 | 'available_at': {
7 | type: DataTypes.DATE,
8 | },
9 | }, {
10 | tableName: 'chef_availabilities',
11 | underscored: true,
12 | timestamps: false,
13 |
14 | });
15 |
16 | Model.associate = (models) => {
17 | };
18 |
19 | return Model;
20 | };
21 |
22 |
--------------------------------------------------------------------------------
/example/meals/Meals/middlewares/welcome/index.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 | const _ = require('lodash');
3 | const requireAll = require('require-all');
4 |
5 | module.exports = function (app) {
6 | app.get('/', (req, res) => {
7 | const middlewares = requireAll({ dirname: `${__dirname}/..` });
8 | const templatePath = `${__dirname}/template.txt`;
9 | const template = _.template(fs.readFileSync(templatePath, 'utf-8'));
10 |
11 | res.send(template({ middlewares: Object.keys(middlewares) }));
12 | });
13 | };
14 |
--------------------------------------------------------------------------------
/example/movies/Movies/middlewares/welcome/index.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 | const _ = require('lodash');
3 | const requireAll = require('require-all');
4 |
5 | module.exports = function (app) {
6 | app.get('/', (req, res) => {
7 | const middlewares = requireAll({ dirname: `${__dirname}/..` });
8 | const templatePath = `${__dirname}/template.txt`;
9 | const template = _.template(fs.readFileSync(templatePath, 'utf-8'));
10 |
11 | res.send(template({ middlewares: Object.keys(middlewares) }));
12 | });
13 | };
14 |
--------------------------------------------------------------------------------
/example/meals/Meals/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | app:
4 | build:
5 | context: .
6 | dockerfile: Dockerfile
7 | container_name: Meals
8 | environment:
9 | - DATABASE_URL=postgres://forest:secret@host.docker.internal:5446/meals
10 | - AUTH_SECRET=e9d7adcb966ef20e2065ac96394b8b4f0324736e108e4c552dd531fe22ca724bd02ccf555534f9aa9b2624d19013d6e3
11 | - PORT=3004
12 | # - SSL_DATABASE=true
13 | # - ENCRYPT_DATABASE=true
14 |
15 | ports:
16 | - "3004:3004"
17 |
--------------------------------------------------------------------------------
/example/movies/Movies/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | app:
4 | build:
5 | context: .
6 | dockerfile: Dockerfile
7 | container_name: Movies
8 | environment:
9 | - DATABASE_URL=postgres://forest:secret@host.docker.internal:5445/movies
10 | - AUTH_SECRET=c6985ba57a187b1394431006260bc78b021987920f3bf83e447bfaee4f3c1d563540725234a59224bcedf3fdf6a33350
11 | - PORT=3005
12 | # - SSL_DATABASE=true
13 | # - ENCRYPT_DATABASE=true
14 |
15 | ports:
16 | - "3005:3005"
17 |
--------------------------------------------------------------------------------
/example/movies/Movies/models/rentals.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('rentals', {
3 | 'customer_id': {
4 | type: DataTypes.INTEGER,
5 | },
6 | 'movie_id': {
7 | type: DataTypes.INTEGER,
8 | },
9 | 'created_at': {
10 | type: DataTypes.DATE,
11 | },
12 | 'updated_at': {
13 | type: DataTypes.DATE,
14 | },
15 | }, {
16 | tableName: 'rentals',
17 | underscored: true,
18 |
19 |
20 | });
21 |
22 | Model.associate = (models) => {
23 | };
24 |
25 | return Model;
26 | };
27 |
28 |
--------------------------------------------------------------------------------
/example/meals/Meals/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Meals",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "start": "node ./bin/www"
7 | },
8 | "dependencies": {
9 | "apollo-server-express": "^2.4.8",
10 | "chalk": "~1.1.3",
11 | "debug": "~4.0.1",
12 | "dotenv": "~6.1.0",
13 | "express": "~4.16.3",
14 | "forest-express-sequelize": "^3.1.0",
15 | "graphql": "^14.2.1",
16 | "graphql-iso-date": "^3.6.1",
17 | "graphql-type-json": "^0.3.0",
18 | "lumber-graphql": "0.0.1-beta.6",
19 | "pg": "~6.1.0",
20 | "require-all": "^3.0.0",
21 | "sequelize": "~5.7.4"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example/meals/Meals/models/ar_internal_metadata.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('ar_internal_metadata', {
3 | 'key': {
4 | type: DataTypes.STRING,
5 | primaryKey: true
6 | },
7 | 'value': {
8 | type: DataTypes.STRING,
9 | },
10 | 'created_at': {
11 | type: DataTypes.DATE,
12 | },
13 | 'updated_at': {
14 | type: DataTypes.DATE,
15 | },
16 | }, {
17 | tableName: 'ar_internal_metadata',
18 | underscored: true,
19 |
20 |
21 | });
22 |
23 | Model.associate = (models) => {
24 | };
25 |
26 | return Model;
27 | };
28 |
29 |
--------------------------------------------------------------------------------
/example/movies/Movies/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Movies",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "start": "node ./bin/www"
7 | },
8 | "dependencies": {
9 | "apollo-server-express": "^2.4.8",
10 | "chalk": "~1.1.3",
11 | "debug": "~4.0.1",
12 | "dotenv": "~6.1.0",
13 | "express": "~4.16.3",
14 | "forest-express-sequelize": "^3.1.0",
15 | "graphql": "^14.2.1",
16 | "graphql-iso-date": "^3.6.1",
17 | "graphql-type-json": "^0.3.0",
18 | "lumber-graphql": "0.0.1-beta.6",
19 | "pg": "~6.1.0",
20 | "require-all": "^3.0.0",
21 | "sequelize": "~5.7.4"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example/meals/Meals/models/orders.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('orders', {
3 | 'customer_id': {
4 | type: DataTypes.INTEGER,
5 | },
6 | 'created_at': {
7 | type: DataTypes.DATE,
8 | },
9 | 'updated_at': {
10 | type: DataTypes.DATE,
11 | },
12 | 'delivery_address': {
13 | type: DataTypes.STRING,
14 | },
15 | 'status': {
16 | type: DataTypes.INTEGER,
17 | },
18 | }, {
19 | tableName: 'orders',
20 | underscored: true,
21 |
22 |
23 | });
24 |
25 | Model.associate = (models) => {
26 | };
27 |
28 | return Model;
29 | };
30 |
31 |
--------------------------------------------------------------------------------
/example/movies/Movies/models/comments.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('comments', {
3 | 'comment': {
4 | type: DataTypes.STRING,
5 | },
6 | 'customer_id': {
7 | type: DataTypes.INTEGER,
8 | },
9 | 'movie_id': {
10 | type: DataTypes.INTEGER,
11 | },
12 | 'created_at': {
13 | type: DataTypes.DATE,
14 | },
15 | 'updated_at': {
16 | type: DataTypes.DATE,
17 | },
18 | 'status': {
19 | type: DataTypes.INTEGER,
20 | },
21 | }, {
22 | tableName: 'comments',
23 | underscored: true,
24 |
25 |
26 | });
27 |
28 | Model.associate = (models) => {
29 | };
30 |
31 | return Model;
32 | };
33 |
34 |
--------------------------------------------------------------------------------
/example/meals/Meals/models/chefs.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('chefs', {
3 | 'firstname': {
4 | type: DataTypes.STRING,
5 | },
6 | 'lastname': {
7 | type: DataTypes.STRING,
8 | },
9 | 'email': {
10 | type: DataTypes.STRING,
11 | },
12 | 'phone': {
13 | type: DataTypes.STRING,
14 | },
15 | 'address': {
16 | type: DataTypes.STRING,
17 | },
18 | 'created_at': {
19 | type: DataTypes.DATE,
20 | },
21 | 'updated_at': {
22 | type: DataTypes.DATE,
23 | },
24 | }, {
25 | tableName: 'chefs',
26 | underscored: true,
27 |
28 |
29 | });
30 |
31 | Model.associate = (models) => {
32 | };
33 |
34 | return Model;
35 | };
36 |
37 |
--------------------------------------------------------------------------------
/example/meals/Meals/models/product_images.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('product_images', {
3 | 'product_id': {
4 | type: DataTypes.INTEGER,
5 | },
6 | 'created_at': {
7 | type: DataTypes.DATE,
8 | },
9 | 'updated_at': {
10 | type: DataTypes.DATE,
11 | },
12 | 'image_file_name': {
13 | type: DataTypes.STRING,
14 | },
15 | 'image_content_type': {
16 | type: DataTypes.STRING,
17 | },
18 | 'image_file_size': {
19 | type: DataTypes.INTEGER,
20 | },
21 | 'image_updated_at': {
22 | type: DataTypes.DATE,
23 | },
24 | }, {
25 | tableName: 'product_images',
26 | underscored: true,
27 |
28 |
29 | });
30 |
31 | Model.associate = (models) => {
32 | };
33 |
34 | return Model;
35 | };
36 |
37 |
--------------------------------------------------------------------------------
/example/meals/Meals/models/customers.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('customers', {
3 | 'firstname': {
4 | type: DataTypes.STRING,
5 | },
6 | 'lastname': {
7 | type: DataTypes.STRING,
8 | },
9 | 'address': {
10 | type: DataTypes.STRING,
11 | },
12 | 'phone': {
13 | type: DataTypes.STRING,
14 | },
15 | 'created_at': {
16 | type: DataTypes.DATE,
17 | },
18 | 'updated_at': {
19 | type: DataTypes.DATE,
20 | },
21 | 'stripe_id': {
22 | type: DataTypes.STRING,
23 | },
24 | 'bulk_action_started_by': {
25 | type: DataTypes.INTEGER,
26 | },
27 | }, {
28 | tableName: 'customers',
29 | underscored: true,
30 |
31 |
32 | });
33 |
34 | Model.associate = (models) => {
35 | };
36 |
37 | return Model;
38 | };
39 |
40 |
--------------------------------------------------------------------------------
/example/meals/Meals/models/delivery_men.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('delivery_men', {
3 | 'firstname': {
4 | type: DataTypes.STRING,
5 | },
6 | 'lastname': {
7 | type: DataTypes.STRING,
8 | },
9 | 'email': {
10 | type: DataTypes.STRING,
11 | },
12 | 'phone': {
13 | type: DataTypes.STRING,
14 | },
15 | 'location': {
16 | type: DataTypes.STRING,
17 | },
18 | 'available': {
19 | type: DataTypes.BOOLEAN,
20 | },
21 | 'created_at': {
22 | type: DataTypes.DATE,
23 | },
24 | 'updated_at': {
25 | type: DataTypes.DATE,
26 | },
27 | 'geoloc': {
28 | type: DataTypes.STRING,
29 | },
30 | }, {
31 | tableName: 'delivery_men',
32 | underscored: true,
33 |
34 |
35 | });
36 |
37 | Model.associate = (models) => {
38 | };
39 |
40 | return Model;
41 | };
42 |
43 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "graphql-stitcher",
3 | "version": "0.0.2-beta.3",
4 | "description": "Make the implementation of GraphQL Schema Stitching easy.",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "npm test",
8 | "start": "node ./index.js"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "git+https://github.com/forestAdmin/graphql-stitcher.git"
13 | },
14 | "keywords": [
15 | "GraphQL",
16 | "API",
17 | "Schema",
18 | "Stitching"
19 | ],
20 | "author": "Sandro Munda ",
21 | "license": "MIT",
22 | "bugs": {
23 | "url": "https://github.com/forestAdmin/graphql-stitcher/issues"
24 | },
25 | "homepage": "https://github.com/forestAdmin/graphql-stitcher#readme",
26 | "dependencies": {
27 | "apollo-link-http": "^1.5.14",
28 | "graphql": "^14.0.0",
29 | "graphql-tag": "^2.10.1",
30 | "graphql-tools": "^4.0.4",
31 | "node-fetch": "^2.3.0"
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/example/api-gateway/index.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const ApolloServer = require('apollo-server-express').ApolloServer;
3 | const GraphQLStitcher = require('graphql-stitcher');
4 |
5 | const app = express();
6 | const port = 3000;
7 |
8 | const MEALS_ENDPOINT = 'http://localhost:3004/graphql';
9 | const MOVIES_ENDPOINT = 'http://localhost:3005/graphql';
10 |
11 | (async () => {
12 | const stitcher = new GraphQLStitcher();
13 |
14 | // Meals endpoint
15 | await stitcher.loadRemoteSchema(MEALS_ENDPOINT);
16 |
17 | // Movies endpoint
18 | await stitcher.loadRemoteSchema(MOVIES_ENDPOINT);
19 |
20 | // Stitch!
21 | const schema = stitcher.stitch();
22 |
23 | const server = new ApolloServer({ introspection: true, playground: true, schema });
24 | server.applyMiddleware({ app, path: '/graphql' });
25 |
26 | app.listen(port, () => console.log(`API Gateway listening on port ${port}!`));
27 | })().catch((err) => {
28 | console.error(err);
29 | });
30 |
--------------------------------------------------------------------------------
/example/meals/Meals/models/products.js:
--------------------------------------------------------------------------------
1 | module.exports = (sequelize, DataTypes) => {
2 | const Model = sequelize.define('products', {
3 | 'title': {
4 | type: DataTypes.STRING,
5 | },
6 | 'description': {
7 | type: DataTypes.STRING,
8 | },
9 | 'instructions': {
10 | type: DataTypes.STRING,
11 | },
12 | 'created_at': {
13 | type: DataTypes.DATE,
14 | },
15 | 'updated_at': {
16 | type: DataTypes.DATE,
17 | },
18 | 'product_type': {
19 | type: DataTypes.INTEGER,
20 | },
21 | 'image_file_name': {
22 | type: DataTypes.STRING,
23 | },
24 | 'image_content_type': {
25 | type: DataTypes.STRING,
26 | },
27 | 'image_file_size': {
28 | type: DataTypes.INTEGER,
29 | },
30 | 'image_updated_at': {
31 | type: DataTypes.DATE,
32 | },
33 | 'price': {
34 | type: DataTypes.DOUBLE,
35 | },
36 | }, {
37 | tableName: 'products',
38 | underscored: true,
39 |
40 |
41 | });
42 |
43 | Model.associate = (models) => {
44 | };
45 |
46 | return Model;
47 | };
48 |
49 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2019 Forest Admin Inc
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/example/meals/Meals/public/favicon.png:
--------------------------------------------------------------------------------
1 | �PNG
2 |
3 |
IHDR @ @ �iq� sRGB ��� ;IDATx�[[O\U��a(����P(7��Zhim�5�Ԉ�F_L��6�&�L����>�c4Qkc4*�����^��J���B�܆;tf��>�!��������Yd8�}]�[��uL/V�ZDST�.�n `X@�#`�n 0,���G�x"� ���F��H�A��}�[��;h��%ʌ,�y��%l�Τ<�&?3��n��>}� ��sґiK��bCB� +���O��I���lZ~U
ύ�|oCx��4�J�!�K-D2 �C��U��y���n��%��ݯ#�LX����냭"��� �܋���P5�P$��U�o�kBY��FS إ�a�q!�O���̾�~�� �vj
4 | ��%�"��w�7�å�F��yL�fC�3�:>�n��n�AG�
5 | 3��~����aȉ�}�0=?|2�f J����=�B ���L`�3 ��̹�>�d?|�7|���P���8`7���s�r_�t_�1�Ȝ��A3 ��r%y�;��ݿ��{Q�Y���w���?u!