SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Ähnlich wie Criando API's com HapiJS

Ähnlich wie 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
 

Mehr von Matheus Fidelis

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

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
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
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
[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
 
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
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 

Criando API's com HapiJS