SlideShare uma empresa Scribd logo
1 de 44
CRIANDO API`S
EMPRESARIAIS
COM
@fidelissauro
Matheus Fidelis
Developer / DevOps
Superlógica Tecnologias
Twitter: @fidelissauro
Github: /msfidelis
Blog: nanoshots.com.be
2
“Any application that can be
written in Javascript, will
eventually be written in
Javascript”
Jeff Atwood - co-fundador
da StackOverflow
3
● Criado por Eran Hammer
● Sr. Architect of Mobile
Platform
● Responsável pela arquitetura
das maiores aplicações Mobile
no Walmart
● OAuth e OAuth2
4
● Express não foi suficiente para o Walmart
● Falhou em grandes equipes e grandes projetos.
● Queria uma solução corporativa.
5
OPEN SOURCE
https://github.com/walmartlabs
● Criado para grandes equipes
● Sistemas complexos
● Ideal para alta disponibilidade
● Segurança
● Proteção de Memória
● Proteção do Event Loop
● Gerenciamento de Timeouts
● Validações Integradas
● Tratamento de Requests
abortados, lifecycle, limites de
clientes e etc
7
8
REN & STIMPY
COMPARAÇÕE
S
9
10
SERVER
11
ROUTES
12
ROUTES
13
BENCHMARKS
https://raygun.com/blog/node-performance/
14
SO QUE ASSIM...
15
NA VIDA REAL...
▫ Hapi ▫ Express
▫ Body-parser
▫ Cookie-parser
▫ Consign
▫ Muster
▫ … middlewares
16
17
NA VIDA REAL...
▫ Express é uma abstração do HTTP Kernel do
Node.
▫ Express te provê ROTAS. Apenas.
▫ Hapi faz vários tratamentos, debug, fallbacks
▫ Proteção do Lifecycle do request
▫ Proteção da memória
▫ Todo o acompanhamento e parsing do HTTP
18
NO GERAL...
▫ Para aplicações grandes
▫ Apps com muitos devs
▫ Apps com muitas
validações e segurança
▫ Coisas Simples
▫ Interfaces REST
▫ POC’s e Services
▫ Cloud Functions
19
DOCKER
PLUGINS
https://hapijs.com/plugin
s
20
▫ Isso sobre m#rd@
▫ Exceptions Logging
▫ Legal pra registrar Dumps
▫ Logs limpos para rastreio
21
https://github.com/hapijs/poop
▫ Validação
▫ Validação agressiva dos requests
▫ Resource Responsibility
22
https://github.com/hapijs/joi
23
https://github.com/hapijs/joi
▫ HTTP-friendly
▫ Error Response Codes
24
https://github.com/hapijs/boom
25
https://github.com/hapijs/boom
26
https://github.com/hapijs/boom
▫ 4xx
▫ Boom.badRequest() - 400
▫ Boom.unauthorized() - 401
▫ Boom.forbidden() - 403
▫ Boom.notFound - 404
▫ 5xx
▫ Boom.notFound() - 500
▫ Boom.notImplemented - 501
▫ Boom.serverUnavailable() - 503
▫ Console web para debug
▫ Vários servidores Hapi
▫ Logs dos Requests
▫ Logs limpos para rastreio
27
https://github.com/hapijs/tv
28
▫ Gerenciador de Templates
▫ EJS
▫ Jade
▫ Mustache
▫ Nunjucks
29
https://github.com/hapijs/vision
VISION
▫ PROXY HANDLER
▫ Proxy e Gateway
▫ Altamente customizável
30
https://github.com/hapijs/h2o2
H2O2
31
https://github.com/hapijs/h2o2
H2O2
32
https://github.com/ryanfitz/hapi-auth-jwt
https://github.com/dwyl/hapi-auth-jwt2
JWT/JWT2
33
JWT/JWT2
34
Authentication
▫ HTTP Basic authentication
▫ https://github.com/hapijs/hapi-auth-basic
▫ Bearer token based authentication
▫ https://github.com/johnbrett/hapi-auth-bearer-
token
▫ Firebase
▫ https://github.com/dsdenes/hapi-auth-firebase
35
Messaging
▫ Hapi-rabbit - RabbitMQ
▫ https://github.com/aduis/hapi-rabbit
▫ Hapi-plugin-websocket
▫ https://github.com/rse/hapi-plugin-websocket
▫ Susie
▫ https://github.com/mtharrison/susie
36
Routes
▫ acquaint
▫ https://github.com/genediazjr/acquaint
▫ hapi-routes
▫ https://github.com/bsiddiqui/hapi-router
▫ hapi-auto-route
▫ https://github.com/sitrakay/hapi-auto-route
37
https://hapijs.com/communit
y
38
Hapi e Eu
39
Boreal Server
https://github.com/msfidelis/boreal
40
Boreal Server
https://github.com/msfidelis/boreal
https://hub.docker.com/r/msfidelis/boreal
▫ “RESTfica” qualquer banco MySQL
▫ MySQL, MariaDB, Aurora Servers
▫ Caching, Query Builder com HTTP methods, Process
Management.
▫ Deploy do banco de dados como um Microservice
▫ Feito para rodar com Docker!
41
Pocket Gateway
https://github.com/msfidelis/pocket-
gateway
▫ Micro API Gateway.
42
Perguntas?
▫ https://twitter.com/fidelissauro
▫ https://github.com/msfidelis
▫ http://nanoshots.com.br
▫ msfidelis01@gmail.com
43
https://github.com/msfidelis/hapijs-demo
44
DEMO/DOJO

Mais conteúdo relacionado

Semelhante a Criando API's com HapiJS

Semelhante a Criando API's com HapiJS (20)

Choose Your Own Adventure with JHipster & Kubernetes - Utah JUG 2020
Choose Your Own Adventure with JHipster & Kubernetes - Utah JUG 2020Choose Your Own Adventure with JHipster & Kubernetes - Utah JUG 2020
Choose Your Own Adventure with JHipster & Kubernetes - Utah JUG 2020
 
URL Design
URL DesignURL Design
URL Design
 
API SECURITY
API SECURITYAPI SECURITY
API SECURITY
 
Implementing an Automated Staging Environment
Implementing an Automated Staging EnvironmentImplementing an Automated Staging Environment
Implementing an Automated Staging Environment
 
Staying on Topic - Invoke OpenFaaS functions with Kafka
Staying on Topic - Invoke OpenFaaS functions with KafkaStaying on Topic - Invoke OpenFaaS functions with Kafka
Staying on Topic - Invoke OpenFaaS functions with Kafka
 
How we are using BigQuery and Apps Scripts at teowaki
How we are using BigQuery and Apps Scripts at teowakiHow we are using BigQuery and Apps Scripts at teowaki
How we are using BigQuery and Apps Scripts at teowaki
 
Web Technologies in Automotive & Robotics (BlinkOn 10)
Web Technologies in Automotive & Robotics (BlinkOn 10)Web Technologies in Automotive & Robotics (BlinkOn 10)
Web Technologies in Automotive & Robotics (BlinkOn 10)
 
Web Services and Android - OSSPAC 2009
Web Services and Android - OSSPAC 2009Web Services and Android - OSSPAC 2009
Web Services and Android - OSSPAC 2009
 
PHP as a Service TDC2019
PHP as a Service TDC2019PHP as a Service TDC2019
PHP as a Service TDC2019
 
The end of polling : why and how to transform a REST API into a Data Streamin...
The end of polling : why and how to transform a REST API into a Data Streamin...The end of polling : why and how to transform a REST API into a Data Streamin...
The end of polling : why and how to transform a REST API into a Data Streamin...
 
Sistema de Notificações com SignalR TDC 2014
Sistema de Notificações com SignalR TDC 2014Sistema de Notificações com SignalR TDC 2014
Sistema de Notificações com SignalR TDC 2014
 
Prototipação em hackathons
Prototipação em hackathonsPrototipação em hackathons
Prototipação em hackathons
 
Revolutionize DevOps with ML capabilities. Deep dive into Amazon CodeGuru and...
Revolutionize DevOps with ML capabilities. Deep dive into Amazon CodeGuru and...Revolutionize DevOps with ML capabilities. Deep dive into Amazon CodeGuru and...
Revolutionize DevOps with ML capabilities. Deep dive into Amazon CodeGuru and...
 
Openshift 3.10 & Container solutions for Blockchain, IoT and Data Science
Openshift 3.10 & Container solutions for Blockchain, IoT and Data ScienceOpenshift 3.10 & Container solutions for Blockchain, IoT and Data Science
Openshift 3.10 & Container solutions for Blockchain, IoT and Data Science
 
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
 
Microservices on a budget meetup
Microservices on a budget   meetupMicroservices on a budget   meetup
Microservices on a budget meetup
 
Ingress? That’s So 2020! Introducing the Kubernetes Gateway API
Ingress? That’s So 2020! Introducing the Kubernetes Gateway APIIngress? That’s So 2020! Introducing the Kubernetes Gateway API
Ingress? That’s So 2020! Introducing the Kubernetes Gateway API
 
Ingress? That’s So 2020! Introducing the Kubernetes Gateway API
Ingress? That’s So 2020! Introducing the Kubernetes Gateway APIIngress? That’s So 2020! Introducing the Kubernetes Gateway API
Ingress? That’s So 2020! Introducing the Kubernetes Gateway API
 
HTML - HyperText Markup Language - HTML5
HTML - HyperText Markup Language - HTML5HTML - HyperText Markup Language - HTML5
HTML - HyperText Markup Language - HTML5
 
Developing Brilliant and Powerful APIs in Ruby & Python
Developing Brilliant and Powerful APIs in Ruby & PythonDeveloping Brilliant and Powerful APIs in Ruby & Python
Developing Brilliant and Powerful APIs in Ruby & Python
 

Mais de Matheus Fidelis

Mais de Matheus Fidelis (10)

Road to serverless
Road to serverlessRoad to serverless
Road to serverless
 
Desbravando o REST com Python
Desbravando o REST com PythonDesbravando o REST com Python
Desbravando o REST com Python
 
Web scraping com python
Web scraping com pythonWeb scraping com python
Web scraping com python
 
Docker Para Maiores - GDG Cabreúva
Docker Para Maiores - GDG CabreúvaDocker Para Maiores - GDG Cabreúva
Docker Para Maiores - GDG Cabreúva
 
Escalando API's com NodeJS, Docker e RabbitMQ
Escalando API's com NodeJS, Docker e RabbitMQEscalando API's com NodeJS, Docker e RabbitMQ
Escalando API's com NodeJS, Docker e RabbitMQ
 
Desmistificando a Amazon AWS
Desmistificando a Amazon AWSDesmistificando a Amazon AWS
Desmistificando a Amazon AWS
 
Docker para maiores
Docker para maioresDocker para maiores
Docker para maiores
 
O Fantástico Mundo de Git
O Fantástico Mundo de GitO Fantástico Mundo de Git
O Fantástico Mundo de Git
 
Introdução a Containers Docker
Introdução a Containers DockerIntrodução a Containers Docker
Introdução a Containers Docker
 
Aula 1 - Testando a Segurança de Sua Aplicação Web
Aula 1 - Testando a Segurança de Sua Aplicação WebAula 1 - Testando a Segurança de Sua Aplicação Web
Aula 1 - Testando a Segurança de Sua Aplicação Web
 

Último

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
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Último (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

Criando API's com HapiJS