SlideShare a Scribd company logo
1 of 54
Download to read offline
REST WEB SERVICE? NO,
GRAPHQL PLEASE!
DIMITRI GIELIS
DIMITRI GIELIS
ABOUT ME
▸ Founder & CEO of APEX R&D
▸ 20+ years of Oracle Experience 

(OCP & APEX Certified)
▸ Oracle ACE Director
▸ “APEX Developer of the year 2009” by Oracle Magazine
▸ “Oracle Developer Choice award (ORDS)” in 2015
▸ Author Expert Oracle APEX
▸ Presenter at Conferences
www.apexofficeprint.comwww.apexRnD.be
http://dgielis.blogspot.com @dgielis
WAYS TO QUERY THE DATABASE?
SQL
REST
GraphQL
SQL
STRUCTUREDQL
GRAPHQL
REST
CREATE API?
REST API
/hr/employees/:id
GET RESPONSE
REST API
CHARACTERISTICS
▸ Server controls the data you get
▸ May need multiple requests to obtain data
▸ Static versions of API
GRAPHQL
CREATE API?
GRAPHQL API
/hr
GET RESPONSE
Query
GRAPHQL
CHARACTERISTICS
▸ Server defines what is available, 

but Client controls the data it get
▸ Single request to get all
▸ Evolve API over time 

(even make fields deprecated)
▸ Auto documented
https://graphql.org
GRAPHQL
HISTORY
▸ Facebook's mobile apps have been powered by GraphQL
since 2012.
▸ A GraphQL spec was open sourced in 2015
▸ Many implementations in different languages
▸ Used by many big companies e.g.
DEMO (CONSUMING)
https://graphql.org/swapi-graphql/
https://www.graphqlhub.com
http://join-monster.herokuapp.com
MORE EXAMPLES
GRAPHQL APIS
▸ https://github.com/APIs-guru/graphql-apis
▸ https://help.shopify.com/en/api/graphql-admin-api/
graphiql-explorer
▸ https://developer.github.com/v4/
▸ https://www.yelp.com/developers/graphql/guides/intro
GETTING
STARTED
GRAPHQL AND THE
ORACLE DATABASE
GRAPHQL AND THE ORACLE DATABASE
BUILDING BLOCKS
▸ Oracle Database
▸ node.js
▸ oracledb
▸ graphql
▸ apollo-server
MY DEVELOPMENT ENVIRONMENT
▸ Visual Studio Code
▸ Sqlcl
▸ Git
▸ node.js & nvm & npm
▸ Instant Oracle client / Oracle Database
INSTALLATION NODE.JS
https://nodejs.org/
GETTING STARTED
CREATE A FIRST NODE PROJECT
▸ npm init
▸ npm install apollo-server graphql oracledb
GETTING STARTED
CREATE A FIRST NODE PROJECT
▸ npm init
▸ npm install apollo-server graphql oracledb
GETTING STARTED
CREATE A FIRST NODE PROJECT
▸ npm init
▸ npm install apollo-server graphql oracledb
GETTING STARTED
CREATE A FIRST NODE PROJECT
▸ npm init
▸ npm install apollo-server graphql oracledb
ABOUT APOLLO
Apollo Server is the best way to quickly build a production-ready, self-documenting API for
GraphQL clients, using data from any source - https://www.apollographql.com/docs/apollo-server/
CREATE AN APOLLO SERVER
const { ApolloServer, gql } = require('apollo-server');
// This is a (sample) collection of books
const books = [{title: 'Book1'},{title: 'Book2'}];
// Type definitions define the "shape" of your data
const typeDefs = gql`
type Book {title: String}
type Query {books: [Book]}
`;
// Resolvers define the technique for fetching the types
const resolvers = { Query: {books: () => books } };
// The Apollo Server can be started by passing
// type definitions and the resolvers
const server = new ApolloServer({ typeDefs, resolvers });
// This `listen` method launches a web-server
server.listen().then(({ url }) => {
console.log(`🚀 Server ready at ${url}`);
});
https://www.apollographql.com/docs/apollo-server/getting-started/
CREATE AN APOLLO SERVER
const { ApolloServer, gql } = require('apollo-server');
// This is a (sample) collection of books
const books = [{title: 'Book1'},{title: 'Book2'}];
// Type definitions define the "shape" of your data
const typeDefs = gql`
type Book {title: String}
type Query {books: [Book]}
`;
// Resolvers define the technique for fetching the types
const resolvers = { Query: {books: () => books } };
// The Apollo Server can be started by passing
// type definitions and the resolvers
const server = new ApolloServer({ typeDefs, resolvers });
// This `listen` method launches a web-server
server.listen().then(({ url }) => {
console.log(`🚀 Server ready at ${url}`);
});
https://www.apollographql.com/docs/apollo-server/getting-started/
CREATE AN APOLLO SERVER
const { ApolloServer, gql } = require('apollo-server');
// This is a (sample) collection of books
const books = [{title: 'Book1'},{title: 'Book2'}];
// Type definitions define the "shape" of your data
const typeDefs = gql`
type Book {title: String}
type Query {books: [Book]}
`;
// Resolvers define the technique for fetching the types
const resolvers = { Query: {books: () => books } };
// The Apollo Server can be started by passing
// type definitions and the resolvers
const server = new ApolloServer({ typeDefs, resolvers });
// This `listen` method launches a web-server
server.listen().then(({ url }) => {
console.log(`🚀 Server ready at ${url}`);
});
https://www.apollographql.com/docs/apollo-server/getting-started/
CREATE AN APOLLO SERVER
const { ApolloServer, gql } = require('apollo-server');
// This is a (sample) collection of books
const books = [{title: 'Book1'},{title: 'Book2'}];
// Type definitions define the "shape" of your data
const typeDefs = gql`
type Book {title: String}
type Query {books: [Book]}
`;
// Resolvers define the technique for fetching the types
const resolvers = { Query: {books: () => books } };
// The Apollo Server can be started by passing
// type definitions and the resolvers
const server = new ApolloServer({ typeDefs, resolvers });
// This `listen` method launches a web-server
server.listen().then(({ url }) => {
console.log(`🚀 Server ready at ${url}`);
});
https://www.apollographql.com/docs/apollo-server/getting-started/
CREATE AN APOLLO SERVER
const { ApolloServer, gql } = require('apollo-server');
// This is a (sample) collection of books
const books = [{title: 'Book1'},{title: 'Book2'}];
// Type definitions define the "shape" of your data
const typeDefs = gql`
type Book {title: String}
type Query {books: [Book]}
`;
// Resolvers define the technique for fetching the types
const resolvers = { Query: {books: () => books } };
// The Apollo Server can be started by passing
// type definitions and the resolvers
const server = new ApolloServer({ typeDefs, resolvers });
// This `listen` method launches a web-server
server.listen().then(({ url }) => {
console.log(`🚀 Server ready at ${url}`);
});
https://www.apollographql.com/docs/apollo-server/getting-started/
CREATE AN APOLLO SERVER
const { ApolloServer, gql } = require('apollo-server');
// This is a (sample) collection of books
const books = [{title: 'Book1'},{title: 'Book2'}];
// Type definitions define the "shape" of your data
const typeDefs = gql`
type Book {title: String}
type Query {books: [Book]}
`;
// Resolvers define the technique for fetching the types
const resolvers = { Query: {books: () => books } };
// The Apollo Server can be started by passing
// type definitions and the resolvers
const server = new ApolloServer({ typeDefs, resolvers });
// This `listen` method launches a web-server
server.listen().then(({ url }) => {
console.log(`🚀 Server ready at ${url}`);
});
https://www.apollographql.com/docs/apollo-server/getting-started/
CREATE AN APOLLO SERVER
const { ApolloServer, gql } = require('apollo-server');
// This is a (sample) collection of books
const books = [{title: 'Book1'},{title: 'Book2'}];
// Type definitions define the "shape" of your data
const typeDefs = gql`
type Book {title: String}
type Query {books: [Book]}
`;
// Resolvers define the technique for fetching the types
const resolvers = { Query: {books: () => books } };
// The Apollo Server can be started by passing
// type definitions and the resolvers
const server = new ApolloServer({ typeDefs, resolvers });
// This `listen` method launches a web-server
server.listen().then(({ url }) => {
console.log(`🚀 Server ready at ${url}`);
});
https://www.apollographql.com/docs/apollo-server/getting-started/
TEST IN BROWSER: HTTP://LOCALHOST:4000
HOOKING UP ORACLE DB WITH NODE-ORACLEDB
QUERY ORACLE DB
var oracledb = require('oracledb');
async function run() {
let connection;
try {
connection = await oracledb.getConnection( {
user : "hr",
password : "hr",
connectString : "localhost/XEPDB1"
});
let result = await connection.execute(
`SELECT manager_id, department_id, department_name
FROM departments
WHERE manager_id = :id`,
[103], // bind value for :id
);
console.log(result.rows);
} catch (err) {
console.error(err);
} finally {
if (connection) {
try {
await connection.close();
} catch (err) {
console.error(err);
}
}
}
}
run();
https://oracle.github.io/node-oracledb/doc/api.html#getstarted
QUERY ORACLE DB
var oracledb = require('oracledb');
async function run() {
let connection;
try {
connection = await oracledb.getConnection( {
user : "hr",
password : "hr",
connectString : "localhost/XEPDB1"
});
let result = await connection.execute(
`SELECT manager_id, department_id, department_name
FROM departments
WHERE manager_id = :id`,
[103], // bind value for :id
);
console.log(result.rows);
} catch (err) {
console.error(err);
} finally {
if (connection) {
try {
await connection.close();
} catch (err) {
console.error(err);
}
}
}
}
run();
https://oracle.github.io/node-oracledb/doc/api.html#getstarted
QUERY ORACLE DB
var oracledb = require('oracledb');
async function run() {
let connection;
try {
connection = await oracledb.getConnection( {
user : "hr",
password : "hr",
connectString : "localhost/XEPDB1"
});
let result = await connection.execute(
`SELECT manager_id, department_id, department_name
FROM departments
WHERE manager_id = :id`,
[103], // bind value for :id
);
console.log(result.rows);
} catch (err) {
console.error(err);
} finally {
if (connection) {
try {
await connection.close();
} catch (err) {
console.error(err);
}
}
}
}
run();
https://oracle.github.io/node-oracledb/doc/api.html#getstarted
QUERY ORACLE DB
var oracledb = require('oracledb');
async function run() {
let connection;
try {
connection = await oracledb.getConnection( {
user : "hr",
password : "hr",
connectString : "localhost/XEPDB1"
});
let result = await connection.execute(
`SELECT manager_id, department_id, department_name
FROM departments
WHERE manager_id = :id`,
[103], // bind value for :id
);
console.log(result.rows);
} catch (err) {
console.error(err);
} finally {
if (connection) {
try {
await connection.close();
} catch (err) {
console.error(err);
}
}
}
}
run();
https://oracle.github.io/node-oracledb/doc/api.html#getstarted
GETTING STARTED
COMBINING APOLLO AND ORACLE
▸ Map SQL to Types
▸ TIP: 

sqlcl to output SQL statement to JSON
▸ convert JSON to GraphQL Types automatically

https://walmartlabs.github.io/json-to-simple-graphql-schema/
DEMO (PROVIDING)
source: https://www.apexofficeprint.com/graphql
MORE ADVANCED SQL & JOINS
JOIN MONSTER
▸ A GraphQL to SQL query execution layer for query
planning and batch data fetching.
https://github.com/acarl005/join-monster
DEMO (PROVIDING)
source: Dan McGhan presentation: emp/dept example
DETAILS OF GRAPHQL
GRAPHQL CONCEPTS
▸ Schema
▸ Object type (character)
▸ Field
▸ Arguments
▸ Scalar type
▸ Interface
DETAILS OF GRAPHQL
HOW TO QUERY A GRAPHQL SERVER
▸ Queries
▸ Fields, Aliases, Fragments
▸ Arguments
▸ Variables
▸ Directives
▸ Operation name
▸ Mutations
▸ Subscriptions
NEXT
INTERESTING RESOURCES & PROJECTS
▸ https://graphql.org/learn/best-practices/
▸ https://blogs.oracle.com/opal/demo:-graphql-with-node-oracledb
▸ https://github.com/sblack4/oracledb-graphql-demo
▸ https://www.prisma.io (no Oracle support yet)
▸ https://github.com/rexxars/sql-to-graphql (unmaintained)

More Related Content

What's hot

Data Analytics and Processing at Snap - Druid Meetup LA - September 2018
Data Analytics and Processing at Snap - Druid Meetup LA - September 2018Data Analytics and Processing at Snap - Druid Meetup LA - September 2018
Data Analytics and Processing at Snap - Druid Meetup LA - September 2018Charles Allen
 
Kalix: Tackling the The Cloud to Edge Continuum
Kalix: Tackling the The Cloud to Edge ContinuumKalix: Tackling the The Cloud to Edge Continuum
Kalix: Tackling the The Cloud to Edge ContinuumJonas Bonér
 
Spark Performance Tuning .pdf
Spark Performance Tuning .pdfSpark Performance Tuning .pdf
Spark Performance Tuning .pdfAmit Raj
 
Conception et développement d'une marketplace basée sur l'architecture micros...
Conception et développement d'une marketplace basée sur l'architecture micros...Conception et développement d'une marketplace basée sur l'architecture micros...
Conception et développement d'une marketplace basée sur l'architecture micros...Adem Amen Allah Thabti
 
Formation JPA Avancé / Hibernate gratuite par Ippon 2014
Formation JPA Avancé / Hibernate gratuite par Ippon 2014Formation JPA Avancé / Hibernate gratuite par Ippon 2014
Formation JPA Avancé / Hibernate gratuite par Ippon 2014Ippon
 
Rapport application web (Spring BOOT,angular4) et mobile(ionc3) gestion des a...
Rapport application web (Spring BOOT,angular4) et mobile(ionc3) gestion des a...Rapport application web (Spring BOOT,angular4) et mobile(ionc3) gestion des a...
Rapport application web (Spring BOOT,angular4) et mobile(ionc3) gestion des a...MOHAMMED MOURADI
 
Build and Deploy Cloud Native Camel Quarkus routes with Tekton and Knative
Build and Deploy Cloud Native Camel Quarkus routes with Tekton and KnativeBuild and Deploy Cloud Native Camel Quarkus routes with Tekton and Knative
Build and Deploy Cloud Native Camel Quarkus routes with Tekton and KnativeOmar Al-Safi
 
rapport de stage de découverte
rapport de stage de découverte rapport de stage de découverte
rapport de stage de découverte SamirElkhyati
 
Apache Kafka, Un système distribué de messagerie hautement performant
Apache Kafka, Un système distribué de messagerie hautement performantApache Kafka, Un système distribué de messagerie hautement performant
Apache Kafka, Un système distribué de messagerie hautement performantALTIC Altic
 
Terraform 0.9 + good practices
Terraform 0.9 + good practicesTerraform 0.9 + good practices
Terraform 0.9 + good practicesRadek Simko
 
A la découverte de vue.js
A la découverte de vue.jsA la découverte de vue.js
A la découverte de vue.jsBruno Bonnin
 
Développement d’une application Web et mobile d’un annuaire médical
Développement d’une application Web et mobile d’un annuaire médicalDéveloppement d’une application Web et mobile d’un annuaire médical
Développement d’une application Web et mobile d’un annuaire médicallitayem bechir
 
Streaming SQL with Apache Calcite
Streaming SQL with Apache CalciteStreaming SQL with Apache Calcite
Streaming SQL with Apache CalciteJulian Hyde
 
Rapport de stage pfe odoo 8
Rapport de stage pfe odoo 8 Rapport de stage pfe odoo 8
Rapport de stage pfe odoo 8 ayoub damir
 
Conception, développement et mise en ligne d’une plateforme Odoo destinée à l...
Conception, développement et mise en ligne d’une plateforme Odoo destinée à l...Conception, développement et mise en ligne d’une plateforme Odoo destinée à l...
Conception, développement et mise en ligne d’une plateforme Odoo destinée à l...Nabil EL Moudden
 
Tadx - Présentation Conteneurisation
Tadx -  Présentation ConteneurisationTadx -  Présentation Conteneurisation
Tadx - Présentation ConteneurisationTADx
 

What's hot (20)

Data Analytics and Processing at Snap - Druid Meetup LA - September 2018
Data Analytics and Processing at Snap - Druid Meetup LA - September 2018Data Analytics and Processing at Snap - Druid Meetup LA - September 2018
Data Analytics and Processing at Snap - Druid Meetup LA - September 2018
 
Kalix: Tackling the The Cloud to Edge Continuum
Kalix: Tackling the The Cloud to Edge ContinuumKalix: Tackling the The Cloud to Edge Continuum
Kalix: Tackling the The Cloud to Edge Continuum
 
Spark Performance Tuning .pdf
Spark Performance Tuning .pdfSpark Performance Tuning .pdf
Spark Performance Tuning .pdf
 
Conception et développement d'une marketplace basée sur l'architecture micros...
Conception et développement d'une marketplace basée sur l'architecture micros...Conception et développement d'une marketplace basée sur l'architecture micros...
Conception et développement d'une marketplace basée sur l'architecture micros...
 
Formation JPA Avancé / Hibernate gratuite par Ippon 2014
Formation JPA Avancé / Hibernate gratuite par Ippon 2014Formation JPA Avancé / Hibernate gratuite par Ippon 2014
Formation JPA Avancé / Hibernate gratuite par Ippon 2014
 
GEmploi : Smart school timetable management software using RFID technology
GEmploi : Smart school timetable management software using RFID technologyGEmploi : Smart school timetable management software using RFID technology
GEmploi : Smart school timetable management software using RFID technology
 
Rapport application web (Spring BOOT,angular4) et mobile(ionc3) gestion des a...
Rapport application web (Spring BOOT,angular4) et mobile(ionc3) gestion des a...Rapport application web (Spring BOOT,angular4) et mobile(ionc3) gestion des a...
Rapport application web (Spring BOOT,angular4) et mobile(ionc3) gestion des a...
 
Rapport final
Rapport finalRapport final
Rapport final
 
Build and Deploy Cloud Native Camel Quarkus routes with Tekton and Knative
Build and Deploy Cloud Native Camel Quarkus routes with Tekton and KnativeBuild and Deploy Cloud Native Camel Quarkus routes with Tekton and Knative
Build and Deploy Cloud Native Camel Quarkus routes with Tekton and Knative
 
rapport de stage de découverte
rapport de stage de découverte rapport de stage de découverte
rapport de stage de découverte
 
Apache Kafka, Un système distribué de messagerie hautement performant
Apache Kafka, Un système distribué de messagerie hautement performantApache Kafka, Un système distribué de messagerie hautement performant
Apache Kafka, Un système distribué de messagerie hautement performant
 
Terraform 0.9 + good practices
Terraform 0.9 + good practicesTerraform 0.9 + good practices
Terraform 0.9 + good practices
 
A la découverte de vue.js
A la découverte de vue.jsA la découverte de vue.js
A la découverte de vue.js
 
Développement d’une application Web et mobile d’un annuaire médical
Développement d’une application Web et mobile d’un annuaire médicalDéveloppement d’une application Web et mobile d’un annuaire médical
Développement d’une application Web et mobile d’un annuaire médical
 
Cv tayachi nadhir f
Cv tayachi nadhir fCv tayachi nadhir f
Cv tayachi nadhir f
 
Streaming SQL with Apache Calcite
Streaming SQL with Apache CalciteStreaming SQL with Apache Calcite
Streaming SQL with Apache Calcite
 
Rapport de stage pfe odoo 8
Rapport de stage pfe odoo 8 Rapport de stage pfe odoo 8
Rapport de stage pfe odoo 8
 
Conception, développement et mise en ligne d’une plateforme Odoo destinée à l...
Conception, développement et mise en ligne d’une plateforme Odoo destinée à l...Conception, développement et mise en ligne d’une plateforme Odoo destinée à l...
Conception, développement et mise en ligne d’une plateforme Odoo destinée à l...
 
Tadx - Présentation Conteneurisation
Tadx -  Présentation ConteneurisationTadx -  Présentation Conteneurisation
Tadx - Présentation Conteneurisation
 
PostgreSQL replication
PostgreSQL replicationPostgreSQL replication
PostgreSQL replication
 

Similar to REST Web Service? No, GraphQL please!

How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js frameworkBen Lin
 
Intro to fog and openstack jp
Intro to fog and openstack jpIntro to fog and openstack jp
Intro to fog and openstack jpSatoshi Konno
 
How to execute an oracle stored procedure with nested table as a parameter fr...
How to execute an oracle stored procedure with nested table as a parameter fr...How to execute an oracle stored procedure with nested table as a parameter fr...
How to execute an oracle stored procedure with nested table as a parameter fr...Priyobroto Ghosh (Mule ESB Certified)
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jerseyb_kathir
 
Managing GraphQL servers with AWS Fargate & Prisma Cloud
Managing GraphQL servers  with AWS Fargate & Prisma CloudManaging GraphQL servers  with AWS Fargate & Prisma Cloud
Managing GraphQL servers with AWS Fargate & Prisma CloudNikolas Burk
 
GraphQL & Prisma from Scratch
GraphQL & Prisma from ScratchGraphQL & Prisma from Scratch
GraphQL & Prisma from ScratchNikolas Burk
 
Serverless Ballerina
Serverless BallerinaServerless Ballerina
Serverless BallerinaBallerina
 
Scala45 spray test
Scala45 spray testScala45 spray test
Scala45 spray testkopiczko
 
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngineGoogle Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngineRoman Kirillov
 
Flask & Flask-restx
Flask & Flask-restxFlask & Flask-restx
Flask & Flask-restxammaraslam18
 
Microservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-dockerMicroservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-dockerKidong Lee
 
Building and Distributing PostgreSQL Extensions Without Learning C
Building and Distributing PostgreSQL Extensions Without Learning CBuilding and Distributing PostgreSQL Extensions Without Learning C
Building and Distributing PostgreSQL Extensions Without Learning CDavid Wheeler
 
Elasticsearch And Ruby [RuPy2012]
Elasticsearch And Ruby [RuPy2012]Elasticsearch And Ruby [RuPy2012]
Elasticsearch And Ruby [RuPy2012]Karel Minarik
 
Javascript: the important bits
Javascript: the important bitsJavascript: the important bits
Javascript: the important bitsChris Saylor
 
Using Sinatra to Build REST APIs in Ruby
Using Sinatra to Build REST APIs in RubyUsing Sinatra to Build REST APIs in Ruby
Using Sinatra to Build REST APIs in RubyLaunchAny
 

Similar to REST Web Service? No, GraphQL please! (20)

How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js framework
 
Intro to fog and openstack jp
Intro to fog and openstack jpIntro to fog and openstack jp
Intro to fog and openstack jp
 
Backbone
BackboneBackbone
Backbone
 
How to execute an oracle stored procedure with nested table as a parameter fr...
How to execute an oracle stored procedure with nested table as a parameter fr...How to execute an oracle stored procedure with nested table as a parameter fr...
How to execute an oracle stored procedure with nested table as a parameter fr...
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jersey
 
Managing GraphQL servers with AWS Fargate & Prisma Cloud
Managing GraphQL servers  with AWS Fargate & Prisma CloudManaging GraphQL servers  with AWS Fargate & Prisma Cloud
Managing GraphQL servers with AWS Fargate & Prisma Cloud
 
Pyrax talk
Pyrax talkPyrax talk
Pyrax talk
 
GraphQL & Prisma from Scratch
GraphQL & Prisma from ScratchGraphQL & Prisma from Scratch
GraphQL & Prisma from Scratch
 
Serverless Ballerina
Serverless BallerinaServerless Ballerina
Serverless Ballerina
 
Scala45 spray test
Scala45 spray testScala45 spray test
Scala45 spray test
 
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngineGoogle Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
 
Flask & Flask-restx
Flask & Flask-restxFlask & Flask-restx
Flask & Flask-restx
 
Corba
CorbaCorba
Corba
 
Microservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-dockerMicroservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-docker
 
Building and Distributing PostgreSQL Extensions Without Learning C
Building and Distributing PostgreSQL Extensions Without Learning CBuilding and Distributing PostgreSQL Extensions Without Learning C
Building and Distributing PostgreSQL Extensions Without Learning C
 
Rack
RackRack
Rack
 
Openshift31-tech.ppt
Openshift31-tech.pptOpenshift31-tech.ppt
Openshift31-tech.ppt
 
Elasticsearch And Ruby [RuPy2012]
Elasticsearch And Ruby [RuPy2012]Elasticsearch And Ruby [RuPy2012]
Elasticsearch And Ruby [RuPy2012]
 
Javascript: the important bits
Javascript: the important bitsJavascript: the important bits
Javascript: the important bits
 
Using Sinatra to Build REST APIs in Ruby
Using Sinatra to Build REST APIs in RubyUsing Sinatra to Build REST APIs in Ruby
Using Sinatra to Build REST APIs in Ruby
 

More from Dimitri Gielis

Bring the light in your Always FREE Oracle Cloud
Bring the light in your Always FREE Oracle CloudBring the light in your Always FREE Oracle Cloud
Bring the light in your Always FREE Oracle CloudDimitri Gielis
 
APEX Office Print (AOP)
APEX Office Print (AOP)APEX Office Print (AOP)
APEX Office Print (AOP)Dimitri Gielis
 
Can You Do That with APEX? Building Not So Straightforward Pages
Can You Do That with APEX? Building Not So Straightforward PagesCan You Do That with APEX? Building Not So Straightforward Pages
Can You Do That with APEX? Building Not So Straightforward PagesDimitri Gielis
 
Bringing Virtual Reality (VR) and Augmented Reality (AR) to APEX
Bringing Virtual Reality (VR) and Augmented Reality (AR) to APEXBringing Virtual Reality (VR) and Augmented Reality (AR) to APEX
Bringing Virtual Reality (VR) and Augmented Reality (AR) to APEXDimitri Gielis
 
Oracle APEX Cheat Sheet
Oracle APEX Cheat SheetOracle APEX Cheat Sheet
Oracle APEX Cheat SheetDimitri Gielis
 
Reporting with Oracle Application Express (APEX)
Reporting with Oracle Application Express (APEX)Reporting with Oracle Application Express (APEX)
Reporting with Oracle Application Express (APEX)Dimitri Gielis
 
Moving your APEX app to the Oracle Exadata Express Cloud
Moving your APEX app to the Oracle Exadata Express CloudMoving your APEX app to the Oracle Exadata Express Cloud
Moving your APEX app to the Oracle Exadata Express CloudDimitri Gielis
 
Oracle APEX for Beginners
Oracle APEX for BeginnersOracle APEX for Beginners
Oracle APEX for BeginnersDimitri Gielis
 
JavaScript straight from the Oracle Database
JavaScript straight from the Oracle DatabaseJavaScript straight from the Oracle Database
JavaScript straight from the Oracle DatabaseDimitri Gielis
 
Service Workers and APEX
Service Workers and APEXService Workers and APEX
Service Workers and APEXDimitri Gielis
 
Real Application Security (RAS) and Oracle Application Express (APEX)
Real Application Security (RAS) and Oracle Application Express (APEX)Real Application Security (RAS) and Oracle Application Express (APEX)
Real Application Security (RAS) and Oracle Application Express (APEX)Dimitri Gielis
 
Moving to the APEX Listener
Moving to the APEX ListenerMoving to the APEX Listener
Moving to the APEX ListenerDimitri Gielis
 
APEX 5 Demo and Best Practices
APEX 5 Demo and Best PracticesAPEX 5 Demo and Best Practices
APEX 5 Demo and Best PracticesDimitri Gielis
 
A Primer on Web Components in APEX
A Primer on Web Components in APEXA Primer on Web Components in APEX
A Primer on Web Components in APEXDimitri Gielis
 
How to make APEX print through Node.js
How to make APEX print through Node.jsHow to make APEX print through Node.js
How to make APEX print through Node.jsDimitri Gielis
 
Oracle Application Express (APEX) and Microsoft Sharepoint integration
Oracle Application Express (APEX) and Microsoft Sharepoint integrationOracle Application Express (APEX) and Microsoft Sharepoint integration
Oracle Application Express (APEX) and Microsoft Sharepoint integrationDimitri Gielis
 

More from Dimitri Gielis (19)

Bring the light in your Always FREE Oracle Cloud
Bring the light in your Always FREE Oracle CloudBring the light in your Always FREE Oracle Cloud
Bring the light in your Always FREE Oracle Cloud
 
APEX Office Print (AOP)
APEX Office Print (AOP)APEX Office Print (AOP)
APEX Office Print (AOP)
 
Can You Do That with APEX? Building Not So Straightforward Pages
Can You Do That with APEX? Building Not So Straightforward PagesCan You Do That with APEX? Building Not So Straightforward Pages
Can You Do That with APEX? Building Not So Straightforward Pages
 
Bringing Virtual Reality (VR) and Augmented Reality (AR) to APEX
Bringing Virtual Reality (VR) and Augmented Reality (AR) to APEXBringing Virtual Reality (VR) and Augmented Reality (AR) to APEX
Bringing Virtual Reality (VR) and Augmented Reality (AR) to APEX
 
Oracle APEX Cheat Sheet
Oracle APEX Cheat SheetOracle APEX Cheat Sheet
Oracle APEX Cheat Sheet
 
Reporting with Oracle Application Express (APEX)
Reporting with Oracle Application Express (APEX)Reporting with Oracle Application Express (APEX)
Reporting with Oracle Application Express (APEX)
 
Moving your APEX app to the Oracle Exadata Express Cloud
Moving your APEX app to the Oracle Exadata Express CloudMoving your APEX app to the Oracle Exadata Express Cloud
Moving your APEX app to the Oracle Exadata Express Cloud
 
Oracle APEX for Beginners
Oracle APEX for BeginnersOracle APEX for Beginners
Oracle APEX for Beginners
 
JavaScript straight from the Oracle Database
JavaScript straight from the Oracle DatabaseJavaScript straight from the Oracle Database
JavaScript straight from the Oracle Database
 
Service Workers and APEX
Service Workers and APEXService Workers and APEX
Service Workers and APEX
 
APEX Office Print
APEX Office PrintAPEX Office Print
APEX Office Print
 
Real Application Security (RAS) and Oracle Application Express (APEX)
Real Application Security (RAS) and Oracle Application Express (APEX)Real Application Security (RAS) and Oracle Application Express (APEX)
Real Application Security (RAS) and Oracle Application Express (APEX)
 
Moving to the APEX Listener
Moving to the APEX ListenerMoving to the APEX Listener
Moving to the APEX Listener
 
APEX Wearables
APEX WearablesAPEX Wearables
APEX Wearables
 
APEX Security 101
APEX Security 101APEX Security 101
APEX Security 101
 
APEX 5 Demo and Best Practices
APEX 5 Demo and Best PracticesAPEX 5 Demo and Best Practices
APEX 5 Demo and Best Practices
 
A Primer on Web Components in APEX
A Primer on Web Components in APEXA Primer on Web Components in APEX
A Primer on Web Components in APEX
 
How to make APEX print through Node.js
How to make APEX print through Node.jsHow to make APEX print through Node.js
How to make APEX print through Node.js
 
Oracle Application Express (APEX) and Microsoft Sharepoint integration
Oracle Application Express (APEX) and Microsoft Sharepoint integrationOracle Application Express (APEX) and Microsoft Sharepoint integration
Oracle Application Express (APEX) and Microsoft Sharepoint integration
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 

Recently uploaded (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

REST Web Service? No, GraphQL please!

  • 1. REST WEB SERVICE? NO, GRAPHQL PLEASE! DIMITRI GIELIS
  • 2. DIMITRI GIELIS ABOUT ME ▸ Founder & CEO of APEX R&D ▸ 20+ years of Oracle Experience 
 (OCP & APEX Certified) ▸ Oracle ACE Director ▸ “APEX Developer of the year 2009” by Oracle Magazine ▸ “Oracle Developer Choice award (ORDS)” in 2015 ▸ Author Expert Oracle APEX ▸ Presenter at Conferences
  • 5.
  • 6. WAYS TO QUERY THE DATABASE? SQL REST GraphQL
  • 7. SQL
  • 10.
  • 13. REST API CHARACTERISTICS ▸ Server controls the data you get ▸ May need multiple requests to obtain data ▸ Static versions of API
  • 16. GRAPHQL CHARACTERISTICS ▸ Server defines what is available, 
 but Client controls the data it get ▸ Single request to get all ▸ Evolve API over time 
 (even make fields deprecated) ▸ Auto documented
  • 18. GRAPHQL HISTORY ▸ Facebook's mobile apps have been powered by GraphQL since 2012. ▸ A GraphQL spec was open sourced in 2015 ▸ Many implementations in different languages ▸ Used by many big companies e.g.
  • 23. MORE EXAMPLES GRAPHQL APIS ▸ https://github.com/APIs-guru/graphql-apis ▸ https://help.shopify.com/en/api/graphql-admin-api/ graphiql-explorer ▸ https://developer.github.com/v4/ ▸ https://www.yelp.com/developers/graphql/guides/intro
  • 25. GRAPHQL AND THE ORACLE DATABASE BUILDING BLOCKS ▸ Oracle Database ▸ node.js ▸ oracledb ▸ graphql ▸ apollo-server
  • 26. MY DEVELOPMENT ENVIRONMENT ▸ Visual Studio Code ▸ Sqlcl ▸ Git ▸ node.js & nvm & npm ▸ Instant Oracle client / Oracle Database
  • 28. GETTING STARTED CREATE A FIRST NODE PROJECT ▸ npm init ▸ npm install apollo-server graphql oracledb
  • 29. GETTING STARTED CREATE A FIRST NODE PROJECT ▸ npm init ▸ npm install apollo-server graphql oracledb
  • 30. GETTING STARTED CREATE A FIRST NODE PROJECT ▸ npm init ▸ npm install apollo-server graphql oracledb
  • 31. GETTING STARTED CREATE A FIRST NODE PROJECT ▸ npm init ▸ npm install apollo-server graphql oracledb
  • 32. ABOUT APOLLO Apollo Server is the best way to quickly build a production-ready, self-documenting API for GraphQL clients, using data from any source - https://www.apollographql.com/docs/apollo-server/
  • 33. CREATE AN APOLLO SERVER const { ApolloServer, gql } = require('apollo-server'); // This is a (sample) collection of books const books = [{title: 'Book1'},{title: 'Book2'}]; // Type definitions define the "shape" of your data const typeDefs = gql` type Book {title: String} type Query {books: [Book]} `; // Resolvers define the technique for fetching the types const resolvers = { Query: {books: () => books } }; // The Apollo Server can be started by passing // type definitions and the resolvers const server = new ApolloServer({ typeDefs, resolvers }); // This `listen` method launches a web-server server.listen().then(({ url }) => { console.log(`🚀 Server ready at ${url}`); }); https://www.apollographql.com/docs/apollo-server/getting-started/
  • 34. CREATE AN APOLLO SERVER const { ApolloServer, gql } = require('apollo-server'); // This is a (sample) collection of books const books = [{title: 'Book1'},{title: 'Book2'}]; // Type definitions define the "shape" of your data const typeDefs = gql` type Book {title: String} type Query {books: [Book]} `; // Resolvers define the technique for fetching the types const resolvers = { Query: {books: () => books } }; // The Apollo Server can be started by passing // type definitions and the resolvers const server = new ApolloServer({ typeDefs, resolvers }); // This `listen` method launches a web-server server.listen().then(({ url }) => { console.log(`🚀 Server ready at ${url}`); }); https://www.apollographql.com/docs/apollo-server/getting-started/
  • 35. CREATE AN APOLLO SERVER const { ApolloServer, gql } = require('apollo-server'); // This is a (sample) collection of books const books = [{title: 'Book1'},{title: 'Book2'}]; // Type definitions define the "shape" of your data const typeDefs = gql` type Book {title: String} type Query {books: [Book]} `; // Resolvers define the technique for fetching the types const resolvers = { Query: {books: () => books } }; // The Apollo Server can be started by passing // type definitions and the resolvers const server = new ApolloServer({ typeDefs, resolvers }); // This `listen` method launches a web-server server.listen().then(({ url }) => { console.log(`🚀 Server ready at ${url}`); }); https://www.apollographql.com/docs/apollo-server/getting-started/
  • 36. CREATE AN APOLLO SERVER const { ApolloServer, gql } = require('apollo-server'); // This is a (sample) collection of books const books = [{title: 'Book1'},{title: 'Book2'}]; // Type definitions define the "shape" of your data const typeDefs = gql` type Book {title: String} type Query {books: [Book]} `; // Resolvers define the technique for fetching the types const resolvers = { Query: {books: () => books } }; // The Apollo Server can be started by passing // type definitions and the resolvers const server = new ApolloServer({ typeDefs, resolvers }); // This `listen` method launches a web-server server.listen().then(({ url }) => { console.log(`🚀 Server ready at ${url}`); }); https://www.apollographql.com/docs/apollo-server/getting-started/
  • 37. CREATE AN APOLLO SERVER const { ApolloServer, gql } = require('apollo-server'); // This is a (sample) collection of books const books = [{title: 'Book1'},{title: 'Book2'}]; // Type definitions define the "shape" of your data const typeDefs = gql` type Book {title: String} type Query {books: [Book]} `; // Resolvers define the technique for fetching the types const resolvers = { Query: {books: () => books } }; // The Apollo Server can be started by passing // type definitions and the resolvers const server = new ApolloServer({ typeDefs, resolvers }); // This `listen` method launches a web-server server.listen().then(({ url }) => { console.log(`🚀 Server ready at ${url}`); }); https://www.apollographql.com/docs/apollo-server/getting-started/
  • 38. CREATE AN APOLLO SERVER const { ApolloServer, gql } = require('apollo-server'); // This is a (sample) collection of books const books = [{title: 'Book1'},{title: 'Book2'}]; // Type definitions define the "shape" of your data const typeDefs = gql` type Book {title: String} type Query {books: [Book]} `; // Resolvers define the technique for fetching the types const resolvers = { Query: {books: () => books } }; // The Apollo Server can be started by passing // type definitions and the resolvers const server = new ApolloServer({ typeDefs, resolvers }); // This `listen` method launches a web-server server.listen().then(({ url }) => { console.log(`🚀 Server ready at ${url}`); }); https://www.apollographql.com/docs/apollo-server/getting-started/
  • 39. CREATE AN APOLLO SERVER const { ApolloServer, gql } = require('apollo-server'); // This is a (sample) collection of books const books = [{title: 'Book1'},{title: 'Book2'}]; // Type definitions define the "shape" of your data const typeDefs = gql` type Book {title: String} type Query {books: [Book]} `; // Resolvers define the technique for fetching the types const resolvers = { Query: {books: () => books } }; // The Apollo Server can be started by passing // type definitions and the resolvers const server = new ApolloServer({ typeDefs, resolvers }); // This `listen` method launches a web-server server.listen().then(({ url }) => { console.log(`🚀 Server ready at ${url}`); }); https://www.apollographql.com/docs/apollo-server/getting-started/
  • 40. TEST IN BROWSER: HTTP://LOCALHOST:4000
  • 41. HOOKING UP ORACLE DB WITH NODE-ORACLEDB
  • 42. QUERY ORACLE DB var oracledb = require('oracledb'); async function run() { let connection; try { connection = await oracledb.getConnection( { user : "hr", password : "hr", connectString : "localhost/XEPDB1" }); let result = await connection.execute( `SELECT manager_id, department_id, department_name FROM departments WHERE manager_id = :id`, [103], // bind value for :id ); console.log(result.rows); } catch (err) { console.error(err); } finally { if (connection) { try { await connection.close(); } catch (err) { console.error(err); } } } } run(); https://oracle.github.io/node-oracledb/doc/api.html#getstarted
  • 43. QUERY ORACLE DB var oracledb = require('oracledb'); async function run() { let connection; try { connection = await oracledb.getConnection( { user : "hr", password : "hr", connectString : "localhost/XEPDB1" }); let result = await connection.execute( `SELECT manager_id, department_id, department_name FROM departments WHERE manager_id = :id`, [103], // bind value for :id ); console.log(result.rows); } catch (err) { console.error(err); } finally { if (connection) { try { await connection.close(); } catch (err) { console.error(err); } } } } run(); https://oracle.github.io/node-oracledb/doc/api.html#getstarted
  • 44. QUERY ORACLE DB var oracledb = require('oracledb'); async function run() { let connection; try { connection = await oracledb.getConnection( { user : "hr", password : "hr", connectString : "localhost/XEPDB1" }); let result = await connection.execute( `SELECT manager_id, department_id, department_name FROM departments WHERE manager_id = :id`, [103], // bind value for :id ); console.log(result.rows); } catch (err) { console.error(err); } finally { if (connection) { try { await connection.close(); } catch (err) { console.error(err); } } } } run(); https://oracle.github.io/node-oracledb/doc/api.html#getstarted
  • 45. QUERY ORACLE DB var oracledb = require('oracledb'); async function run() { let connection; try { connection = await oracledb.getConnection( { user : "hr", password : "hr", connectString : "localhost/XEPDB1" }); let result = await connection.execute( `SELECT manager_id, department_id, department_name FROM departments WHERE manager_id = :id`, [103], // bind value for :id ); console.log(result.rows); } catch (err) { console.error(err); } finally { if (connection) { try { await connection.close(); } catch (err) { console.error(err); } } } } run(); https://oracle.github.io/node-oracledb/doc/api.html#getstarted
  • 46. GETTING STARTED COMBINING APOLLO AND ORACLE ▸ Map SQL to Types ▸ TIP: 
 sqlcl to output SQL statement to JSON ▸ convert JSON to GraphQL Types automatically
 https://walmartlabs.github.io/json-to-simple-graphql-schema/
  • 47.
  • 49. MORE ADVANCED SQL & JOINS JOIN MONSTER ▸ A GraphQL to SQL query execution layer for query planning and batch data fetching. https://github.com/acarl005/join-monster
  • 50. DEMO (PROVIDING) source: Dan McGhan presentation: emp/dept example
  • 51.
  • 52. DETAILS OF GRAPHQL GRAPHQL CONCEPTS ▸ Schema ▸ Object type (character) ▸ Field ▸ Arguments ▸ Scalar type ▸ Interface
  • 53. DETAILS OF GRAPHQL HOW TO QUERY A GRAPHQL SERVER ▸ Queries ▸ Fields, Aliases, Fragments ▸ Arguments ▸ Variables ▸ Directives ▸ Operation name ▸ Mutations ▸ Subscriptions
  • 54. NEXT INTERESTING RESOURCES & PROJECTS ▸ https://graphql.org/learn/best-practices/ ▸ https://blogs.oracle.com/opal/demo:-graphql-with-node-oracledb ▸ https://github.com/sblack4/oracledb-graphql-demo ▸ https://www.prisma.io (no Oracle support yet) ▸ https://github.com/rexxars/sql-to-graphql (unmaintained)