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

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
 
Oracle REST Data Services: Options for your Web Services
Oracle REST Data Services: Options for your Web ServicesOracle REST Data Services: Options for your Web Services
Oracle REST Data Services: Options for your Web ServicesJeff Smith
 
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
 
Oracle Cloud Infrastructure (OCI)
Oracle Cloud Infrastructure (OCI)Oracle Cloud Infrastructure (OCI)
Oracle Cloud Infrastructure (OCI)emmajones88
 
2019 - OOW - Database Migration Methods from On-Premise to Cloud
2019 - OOW - Database Migration Methods from On-Premise to Cloud2019 - OOW - Database Migration Methods from On-Premise to Cloud
2019 - OOW - Database Migration Methods from On-Premise to CloudMarcus Vinicius Miguel Pedro
 
Find Anything In Your APEX App - Fuzzy Search with Oracle Text
Find Anything In Your APEX App - Fuzzy Search with Oracle TextFind Anything In Your APEX App - Fuzzy Search with Oracle Text
Find Anything In Your APEX App - Fuzzy Search with Oracle TextCarsten Czarski
 
Oracle REST Data Services Best Practices/ Overview
Oracle REST Data Services Best Practices/ OverviewOracle REST Data Services Best Practices/ Overview
Oracle REST Data Services Best Practices/ OverviewKris Rice
 
01 oracle application integration overview
01 oracle application integration overview01 oracle application integration overview
01 oracle application integration overviewnksolanki
 
Examples from Pune meetup
Examples from Pune meetupExamples from Pune meetup
Examples from Pune meetupSantosh Ojha
 
Oracle Cloud Infrastructure.pptx
Oracle Cloud Infrastructure.pptxOracle Cloud Infrastructure.pptx
Oracle Cloud Infrastructure.pptxGarvitNTT
 
Microservices with Apache Camel
Microservices with Apache CamelMicroservices with Apache Camel
Microservices with Apache CamelClaus Ibsen
 
Oracle Database Migration to Oracle Cloud Infrastructure
Oracle Database Migration to Oracle Cloud InfrastructureOracle Database Migration to Oracle Cloud Infrastructure
Oracle Database Migration to Oracle Cloud InfrastructureSinanPetrusToma
 
Oracle Application Express 20.2 New Features
Oracle Application Express 20.2 New FeaturesOracle Application Express 20.2 New Features
Oracle Application Express 20.2 New Featuresmsewtz
 
API-first development
API-first developmentAPI-first development
API-first developmentVasco Veloso
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache CamelClaus Ibsen
 
Clean architecture with ddd layering in php
Clean architecture with ddd layering in phpClean architecture with ddd layering in php
Clean architecture with ddd layering in phpLeonardo Proietti
 
The Role of IAM in Microservices
The Role of IAM in MicroservicesThe Role of IAM in Microservices
The Role of IAM in MicroservicesWSO2
 
Oracle apex training
Oracle apex trainingOracle apex training
Oracle apex trainingVasudha India
 

What's hot (20)

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)
 
Oracle REST Data Services: Options for your Web Services
Oracle REST Data Services: Options for your Web ServicesOracle REST Data Services: Options for your Web Services
Oracle REST Data Services: Options for your Web Services
 
Writing clean code
Writing clean codeWriting clean code
Writing clean code
 
Reporting with Oracle Application Express (APEX)
Reporting with Oracle Application Express (APEX)Reporting with Oracle Application Express (APEX)
Reporting with Oracle Application Express (APEX)
 
Oracle Cloud Infrastructure (OCI)
Oracle Cloud Infrastructure (OCI)Oracle Cloud Infrastructure (OCI)
Oracle Cloud Infrastructure (OCI)
 
2019 - OOW - Database Migration Methods from On-Premise to Cloud
2019 - OOW - Database Migration Methods from On-Premise to Cloud2019 - OOW - Database Migration Methods from On-Premise to Cloud
2019 - OOW - Database Migration Methods from On-Premise to Cloud
 
Find Anything In Your APEX App - Fuzzy Search with Oracle Text
Find Anything In Your APEX App - Fuzzy Search with Oracle TextFind Anything In Your APEX App - Fuzzy Search with Oracle Text
Find Anything In Your APEX App - Fuzzy Search with Oracle Text
 
Oracle REST Data Services Best Practices/ Overview
Oracle REST Data Services Best Practices/ OverviewOracle REST Data Services Best Practices/ Overview
Oracle REST Data Services Best Practices/ Overview
 
01 oracle application integration overview
01 oracle application integration overview01 oracle application integration overview
01 oracle application integration overview
 
Oracle Cloud
Oracle CloudOracle Cloud
Oracle Cloud
 
Examples from Pune meetup
Examples from Pune meetupExamples from Pune meetup
Examples from Pune meetup
 
Oracle Cloud Infrastructure.pptx
Oracle Cloud Infrastructure.pptxOracle Cloud Infrastructure.pptx
Oracle Cloud Infrastructure.pptx
 
Microservices with Apache Camel
Microservices with Apache CamelMicroservices with Apache Camel
Microservices with Apache Camel
 
Oracle Database Migration to Oracle Cloud Infrastructure
Oracle Database Migration to Oracle Cloud InfrastructureOracle Database Migration to Oracle Cloud Infrastructure
Oracle Database Migration to Oracle Cloud Infrastructure
 
Oracle Application Express 20.2 New Features
Oracle Application Express 20.2 New FeaturesOracle Application Express 20.2 New Features
Oracle Application Express 20.2 New Features
 
API-first development
API-first developmentAPI-first development
API-first development
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache Camel
 
Clean architecture with ddd layering in php
Clean architecture with ddd layering in phpClean architecture with ddd layering in php
Clean architecture with ddd layering in php
 
The Role of IAM in Microservices
The Role of IAM in MicroservicesThe Role of IAM in Microservices
The Role of IAM in Microservices
 
Oracle apex training
Oracle apex trainingOracle apex training
Oracle apex training
 

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
 
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
 
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
 
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
 

More from Dimitri Gielis (13)

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)
 
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
 
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
 
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
 

Recently uploaded

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Recently uploaded (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

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)