SlideShare una empresa de Scribd logo
1 de 89
Descargar para leer sin conexión
Backend, App e Internet das Coisas
com NodeJS e
Google Cloud Platform
Alvaro Viebrantz
aviebrantz.com.br
@alvaroviebrantz
medium.com/iot-bootcamp
1
Alvaro Viebrantz
DevMT e GDGCuiabá
Fullstack developer
aviebrantz.com.br // @alvaroviebrantz
medium.com/iot-bootcamp
2
Agenda
• O que é computação em nuvem.
• Google Cloud Platform Overview.
• NodeJS
• Estudo de Caso - PacktPub Notifier
• Backend - Google App Engine
• App - React Native + Firebase
• IoT - Alexa Custom Skill
3
4
38anos
Computadores Primitivos Computadores Pessoais
5
15anos
Computadores Pessoais Internet
6
12anos
Internet Smartphones / Nuvem / Mobile
7
“The more advanced we become
the faster we become at
advancing”
"Marco Annunziata: Welcome to the Age of the Industrial Internet"8
9
10
4.7
bilhões de
página
A Web é gigante hoje
Era do
Zetabyte*
* 1000 Exabytes
36.000
anos
de video
em hd
Últimos
20anos
http://www.livescience.com/54094-how-big-is-the-internet.html
11
Nossa noção de sucesso mudou…
12
13
14
http://press.spotify.com/us/category/pictures/
15
16
Como isso é possível ?
17
18
19
Pilares
Disponibilidade Manutenção Escalável
Economia
20
Escalabilidade
Horizontal
Escalabilidade
VerticalX
21
22
Porque Google Cloud Platform ?
23
O Google Cloud Platform é construído
na mesma infraestrutura que os
serviços do google rodam
• Rede Global
• Redundância
• Infraestrutura inovadora
24
25
Regiões
26
Vantagens
Preço
(Cobrança por minuto)
Maquinas Customizáveis

(até GPU)
Facilmente Escalável
Developer Experience ❤
27
28
29
Estudo de Caso
30
Estudo de Caso
PacktPub Notifier
Backend
App
IoT
31
32
Node.js
• Engine V8 do Google Chrome
• Rápido e escalável
• Orientado a eventos e não bloqueante
• Muito leve
• Perfeito para aplicações real-time
33
É apenas Javascript
• Navegador
• Server side
• Desktop - Electron e NW
• Mobile - Cordova, Ionic, React Native, etc.
• Embarcado - Mongoose OS e Espruino
• Geladeira, torradeira, etc
34
Ecossistema rico
• Muitas ferramentas feitas com Node
• Webpack ❤
• Gerenciadores de pacotes
• NPM e Yarn
• Editores
• Visual Studio Code, Atom, Webstorm
• Mais de 450 mil pacotes no npmjs.com
35
Web Frameworks
• Express.js
• Hapi.js
• Koa
36
Stack escolhido
• Hapi.js no Backend
• Aplicativos iOS e Android nativos com React Native
• Vários serviços do GCP
• Database, Cron, Tasks, HTTPS, etc
37
PacktPub Notifier v0.1
iOS e
Android
Packt
Publishing
Website
Backend
38
Hello World com HapiJS
const Hapi = require('hapi');
const server = new Hapi.Server();
server.connection({
host: '0.0.0.0',
port: process.env.PORT || 8080
});
server.route({
method: 'GET',
path: '/api/tasks/fetch-books',
config: {
handler: (request, reply) => {
reply({ message: 'Hello
World'})
}
}
});
server.start((err) => {
if (err) {
throw err;
}
});
39
Web Scrapping
'use strict';
const cheerio = require('cheerio');
const fetch = require('node-fetch');
const urlFreeLearning = 'http://www.packtpub.com/packt/offers/free-learning/';
class PackPubCrawler {
/* Código omitido */
async fetchBooksFromPacktPub() {
let body = await this.fetchPageBody();
let documentSelector = cheerio.load(body);
let currentBook = this.scrapeCurrentBook(documentSelector);
return {
currentBook
};
}
}
module.exports = PackPubCrawler;
40
Api de Livros
'use strict';
const Boom = require('boom');
const PackPubCrawler = require('../PacktPubCrawler');
module.exports = {
method: 'GET',
path: '/api/books',
config: {
handler: async (request, reply) => {
try {
const crawler = new PackPubCrawler();
let books = await crawler.fetchBooksFromPacktPub();
console.log('Success Fetching Books');
reply({ books });
} catch (e) {
console.log('Error Fetching Books', e);
reply(Boom.badGateway('Xablau', e))
}
}
}
}
41
Api de Livros
42
43
Nuvem
IaaS

Infrastructre as a Service
CaaS

Container/Cluster as a
Service
PaaS

Platform as a Service
SaaS

Software as a Service
GoogleVocê
44
Nuvem
IaaS

Infrastructre as a Service
On Premise PaaS

Platform as a Service
SaaS

Software as a Service
• Aplicação
• Dados
• Runtime
• Middleware
• SO
• Virtualização
• Servidores
• Storage
• Redes
• Aplicação
• Dados
• Runtime
• Middleware
• SO
• Virtualização
• Servidores
• Storage
• Redes
• Aplicação
• Dados
• Runtime
• Middleware
• SO
• Virtualização
• Servidores
• Storage
• Redes
• Aplicação
• Dados
• Runtime
• Middleware
• SO
• Virtualização
• Servidores
• Storage
• Redes
Gerenciado por você
Gerenciado magicamente45
Google App Engine - Standard vs Flexible
46
47
48
https://googlecloudplatform.github.io/google-cloud-node
49
1. Instale o Cloud SDK (cli)
2. Configure o app.yaml
3. cloud app deploy
https://cloud.google.com/sdk/
runtime: nodejs
env: flex
skip_files:
- ^node_modules$
resources:
cpu: .5
memory_gb: .6
disk_size_gb: 10
manual_scaling:
instances: 1
#automatic_scaling:
# min_num_instances: 1
# max_num_instances: 1
# cool_down_period_sec: 120
# cpu_utilization:
# target_utilization: 0.8
50
PacktPub Notifier v0.1 - Fail
51
Really slow rest api
52
PacktPub Notifier v0.2
iOS e
Android
Packt
Publishing
Website
Storage

Database
53
We need a database
54
NoSQL escolhido - Flexibilidade
55
Serviço de Livros - Salvando
const Datastore = require('@google-cloud/datastore');
// Instantiates a client
const datastore = Datastore({
projectId: config.projectId
});
const kind = 'Book';
class BookService {
/* Codigo omitido */
async save(book) {
let slug = this.getSlug(book);
book.slug = slug;
const bookKey = datastore.key([kind, slug]);
let bookEntity = {
key: bookKey,
data: book
};
return datastore.save(bookEntity);
}
}
56
Serviço de Livros - Consulta
// The kind for the new entity
const kind = 'Book';
class BookService {
/* Codigo omitido */
async all() {
const query = datastore.createQuery(kind)
.order('date', { descending: true });
let results = await datastore.runQuery(query);
return results[0];
}
}
57
API de tarefa de busca e armazenamento de livros
module.exports = {
method: 'GET',
path: '/api/tasks/fetch-books',
config: {
handler: async (request, reply) => {
const crawler = new PackPubCrawler();
let books = await crawler.fetchBooksFromPacktPub();
const service = new BooksService();
let slug = service.getSlug(books.currentBook);
let exists = await service.exists(slug);
if (!exists) {
// Save new book
await service.save(books.currentBook);
//TODO: Notify clients that subscribed to this
}
reply({ books });
}
}
}
58
API de Livros
const BooksService = require('../BooksService');
module.exports = {
method: 'GET',
path: '/api/books',
config: {
handler: async (request, reply) => {
let service = new BooksService();
let books = await service.all();
reply({ books });
}
}
}
59
API de Livros
60
Datastore console
61
PacktPub Notifier v0.2
iOS e
Android
Packt
Publishing
Website
62
Agendamento de tarefas
Como fazer em ambiente
distribuido ?
63
Agendamento de tarefas
64
Agendamento de tarefas - Gambiarra
65
1. Sintaxe do unix cron ou mais natural
2. Configure um cron.yaml
3. cloud app deploy cron.yaml
Google App Engine - cron.yaml
cron:
- description: fetch book every 30 mins
url: /api/tasks/fetch-books
schedule: every 30 mins
target: default
66
Google App Engine - cron.yaml
67
Google App Engine - Logs, monitoramento e trace
1. Pacote @google/cloud-trace
2. Just works
if (process.env.NODE_ENV === 'production') {
require('@google/cloud-trace').start();
}
68
Google App Engine - Logs, monitoramento e trace
69
Google App Engine - Logs, monitoramento e trace
70
PacktPub Notifier v0.5
iOS e
Android
Packt
Publishing
Website
71
Push Notifications
72%
Abrem o app quando
recebe uma notificação
72
Fluxo Push Notifications
Android iOS
Backend
GCM APNS
Device
Token
73
74
75
const admin = require("firebase-admin");
let credential = admin.credential.applicationDefault();
admin.initializeApp({
credential,
databaseURL: "https://iot-bootcamp-158521.firebaseio.com"
});
const messaging = admin.messaging();
const TOPIC_NAME = 'receive_book_notification';
class BookNotificationService {
async notifyAllClients(book) {
var payload = {
notification: {
title: `${book.title} is free today!`,
body: `Open the app to claim this book.`
}
};
return messaging.sendToTopic(TOPIC_NAME, payload);
}
}
Firebase Admin SDK
76
Client Side - React Native
import Firestack from 'react-native-firestack';
import FCM from 'react-native-fcm';
const TOPIC_NAME = 'receive_book_notification';
async subscribe() {
let { wantsToReceiveNotifications } = this.state;
if (!wantsToReceiveNotifications) {
FCM.requestPermissions();
FCM.subscribeToTopic(TOPIC_NAME);
firestack.analytics.logEventWithName('subscribe', {});
} else {
FCM.unsubscribeFromTopic(TOPIC_NAME);
firestack.analytics.logEventWithName('unsubscribe', {});
}
this.setState({ wantsToReceiveNotifications: !
wantsToReceiveNotifications })
}
77
Firebase Analytics e Push
78
iOS e
Android
PacktPub Notifier v0.8
Packt
Publishing
Website
79
80
Fluxo Alexa Custom Skill
Backend
Usuário
Alexa, Ask Packt Publishing
Fan what’s the book of the day
The free book of the day is title
Learning Raspberry Pi
Alexa Skill
HTTPS
81
Api de integração com a Alexa
const BooksService = require('../BooksService');
module.exports = {
method: 'POST',
path: '/api/alexa',
config: {
handler: async (request, reply) => {
let service = new BooksService();
let book = await service.getLastBook();
let message = `The free book of the day is titled $
{book.title}`;
reply({
"version": "1.0",
"sessionAttributes": {},
"response": {
"shouldEndSession": true,
"outputSpeech": {
"type": "SSML",
"ssml": `<speak>${message}</speak>`
},
}
});
}
}
} 82
PacktPub Notifier - Final
iOS e
Android
Amazon
Echo
Alexa
Custom
Skill
Packt
Publishing
Website
83
Futuro ?
84
• Funções escritas em NodeJS
• Escalabilidade automatica
• Serverless
• Podem ser chamadas por eventos
• Mudanças de arquivo, banco, http, etc.
85
Serverless
86
Duvidas ?
Alvaro Viebrantz
aviebrantz.com.br
@alvaroviebrantz
medium.com/iot-bootcamp
https://github.com/alvarowolfx/packtpub-notifier-gcp
87
Links úteis
• https://cloud.google.com/sdk/
• https://developers.google.com
• https://cloud.google.com/products/
• https://firebase.google.com
• https://nodejs.org/en/
• https://developer.amazon.com
• https://facebook.github.io/react-native/
88
Referência
• https://pt.slideshare.net/FrancescoMarchitelli1/google-cloud-platform-47074110
• https://www.infoq.com/br/presentations/plataforma-digital-com-google-cloud-
platform
• https://cloud.google.com/icons/
89

Más contenido relacionado

Destacado

Introdução a Machine Learning e TensorFlow
Introdução a Machine Learning e TensorFlowIntrodução a Machine Learning e TensorFlow
Introdução a Machine Learning e TensorFlowGuilherme Campos
 
Introdução a Machine Learning e TensorFlow
Introdução a Machine Learning e TensorFlowIntrodução a Machine Learning e TensorFlow
Introdução a Machine Learning e TensorFlowDevMT
 
Growing Makers in Medicine, Life Sciences, and Healthcare
Growing Makers in Medicine, Life Sciences, and HealthcareGrowing Makers in Medicine, Life Sciences, and Healthcare
Growing Makers in Medicine, Life Sciences, and HealthcareBohyun Kim
 
Iron Values TPC, Spare 3, part 1/2
Iron Values TPC, Spare 3, part 1/2Iron Values TPC, Spare 3, part 1/2
Iron Values TPC, Spare 3, part 1/2Radiochocolate
 
Scrum! But ... SAP Inside Track Frankfurt 2017
Scrum! But ... SAP Inside Track Frankfurt 2017Scrum! But ... SAP Inside Track Frankfurt 2017
Scrum! But ... SAP Inside Track Frankfurt 2017Martin Fischer
 
Игорь Фесенко "What’s New in C# 7.0"
Игорь Фесенко "What’s New in C# 7.0"Игорь Фесенко "What’s New in C# 7.0"
Игорь Фесенко "What’s New in C# 7.0"Fwdays
 
Using Onyx in anger
Using Onyx in angerUsing Onyx in anger
Using Onyx in angerSimon Belak
 
Packet optical transformation ofc2017
Packet optical transformation ofc2017Packet optical transformation ofc2017
Packet optical transformation ofc2017domenico di mola
 
JLL's City Momentum Index 2017
JLL's City Momentum Index 2017JLL's City Momentum Index 2017
JLL's City Momentum Index 2017JLL
 
Alfalfa homoeopathic materia medica slide show presentation by Dr. Hansaraj s...
Alfalfa homoeopathic materia medica slide show presentation by Dr. Hansaraj s...Alfalfa homoeopathic materia medica slide show presentation by Dr. Hansaraj s...
Alfalfa homoeopathic materia medica slide show presentation by Dr. Hansaraj s...Dr.hansraj salve
 
10 bài
10 bài10 bài
10 bàibap19
 
Doha courses plan 2017
Doha courses plan 2017Doha courses plan 2017
Doha courses plan 2017Khaled Ramadan
 
Angular of things: angular2 + web bluetooth
Angular of things: angular2 + web bluetoothAngular of things: angular2 + web bluetooth
Angular of things: angular2 + web bluetoothSergio Castillo Yrizales
 
Wall Street Mobile Technologies Conference, Bank's "Uber Moment" and Open Ban...
Wall Street Mobile Technologies Conference, Bank's "Uber Moment" and Open Ban...Wall Street Mobile Technologies Conference, Bank's "Uber Moment" and Open Ban...
Wall Street Mobile Technologies Conference, Bank's "Uber Moment" and Open Ban...John Marx
 
Меню EverJazz
Меню EverJazzМеню EverJazz
Меню EverJazziamtheocean
 
The greatest tragedy of western front pakistani stupidity at its lowest height
The greatest tragedy of western front   pakistani stupidity at its lowest heightThe greatest tragedy of western front   pakistani stupidity at its lowest height
The greatest tragedy of western front pakistani stupidity at its lowest heightAgha A
 
Gustavo Germano Proyecto Ausencias
Gustavo Germano Proyecto AusenciasGustavo Germano Proyecto Ausencias
Gustavo Germano Proyecto AusenciasMonica Oporto
 

Destacado (20)

Introdução a Machine Learning e TensorFlow
Introdução a Machine Learning e TensorFlowIntrodução a Machine Learning e TensorFlow
Introdução a Machine Learning e TensorFlow
 
Introdução a Machine Learning e TensorFlow
Introdução a Machine Learning e TensorFlowIntrodução a Machine Learning e TensorFlow
Introdução a Machine Learning e TensorFlow
 
Go-jek's Go-Food Chatbot
Go-jek's Go-Food ChatbotGo-jek's Go-Food Chatbot
Go-jek's Go-Food Chatbot
 
El currículum de mi vida
El currículum de mi vidaEl currículum de mi vida
El currículum de mi vida
 
Growing Makers in Medicine, Life Sciences, and Healthcare
Growing Makers in Medicine, Life Sciences, and HealthcareGrowing Makers in Medicine, Life Sciences, and Healthcare
Growing Makers in Medicine, Life Sciences, and Healthcare
 
Iron Values TPC, Spare 3, part 1/2
Iron Values TPC, Spare 3, part 1/2Iron Values TPC, Spare 3, part 1/2
Iron Values TPC, Spare 3, part 1/2
 
Scrum! But ... SAP Inside Track Frankfurt 2017
Scrum! But ... SAP Inside Track Frankfurt 2017Scrum! But ... SAP Inside Track Frankfurt 2017
Scrum! But ... SAP Inside Track Frankfurt 2017
 
Игорь Фесенко "What’s New in C# 7.0"
Игорь Фесенко "What’s New in C# 7.0"Игорь Фесенко "What’s New in C# 7.0"
Игорь Фесенко "What’s New in C# 7.0"
 
Using Onyx in anger
Using Onyx in angerUsing Onyx in anger
Using Onyx in anger
 
Packet optical transformation ofc2017
Packet optical transformation ofc2017Packet optical transformation ofc2017
Packet optical transformation ofc2017
 
JLL's City Momentum Index 2017
JLL's City Momentum Index 2017JLL's City Momentum Index 2017
JLL's City Momentum Index 2017
 
Alfalfa homoeopathic materia medica slide show presentation by Dr. Hansaraj s...
Alfalfa homoeopathic materia medica slide show presentation by Dr. Hansaraj s...Alfalfa homoeopathic materia medica slide show presentation by Dr. Hansaraj s...
Alfalfa homoeopathic materia medica slide show presentation by Dr. Hansaraj s...
 
10 bài
10 bài10 bài
10 bài
 
Ross broiler handbook
Ross broiler handbook Ross broiler handbook
Ross broiler handbook
 
Doha courses plan 2017
Doha courses plan 2017Doha courses plan 2017
Doha courses plan 2017
 
Angular of things: angular2 + web bluetooth
Angular of things: angular2 + web bluetoothAngular of things: angular2 + web bluetooth
Angular of things: angular2 + web bluetooth
 
Wall Street Mobile Technologies Conference, Bank's "Uber Moment" and Open Ban...
Wall Street Mobile Technologies Conference, Bank's "Uber Moment" and Open Ban...Wall Street Mobile Technologies Conference, Bank's "Uber Moment" and Open Ban...
Wall Street Mobile Technologies Conference, Bank's "Uber Moment" and Open Ban...
 
Меню EverJazz
Меню EverJazzМеню EverJazz
Меню EverJazz
 
The greatest tragedy of western front pakistani stupidity at its lowest height
The greatest tragedy of western front   pakistani stupidity at its lowest heightThe greatest tragedy of western front   pakistani stupidity at its lowest height
The greatest tragedy of western front pakistani stupidity at its lowest height
 
Gustavo Germano Proyecto Ausencias
Gustavo Germano Proyecto AusenciasGustavo Germano Proyecto Ausencias
Gustavo Germano Proyecto Ausencias
 

Similar a Backend, app e internet das coisas com NodeJS no Google Cloud Platform

OpenStack API's and WSGI
OpenStack API's and WSGIOpenStack API's and WSGI
OpenStack API's and WSGIMike Pittaro
 
Spark on Dataproc - Israel Spark Meetup at taboola
Spark on Dataproc - Israel Spark Meetup at taboolaSpark on Dataproc - Israel Spark Meetup at taboola
Spark on Dataproc - Israel Spark Meetup at taboolatsliwowicz
 
Real World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS ApplicationReal World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS ApplicationBen Hall
 
Django deployment with PaaS
Django deployment with PaaSDjango deployment with PaaS
Django deployment with PaaSAppsembler
 
Hybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKitHybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKitAriya Hidayat
 
Hybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKitHybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKitAriya Hidayat
 
Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010Chris Ramsdale
 
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...wesley chun
 
Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)HungWei Chiu
 
Building production-quality apps with Node.js
Building production-quality apps with Node.jsBuilding production-quality apps with Node.js
Building production-quality apps with Node.jsmattpardee
 
Dev fest 2020 taiwan how to debug microservices on kubernetes as a pros (ht...
Dev fest 2020 taiwan   how to debug microservices on kubernetes as a pros (ht...Dev fest 2020 taiwan   how to debug microservices on kubernetes as a pros (ht...
Dev fest 2020 taiwan how to debug microservices on kubernetes as a pros (ht...KAI CHU CHUNG
 
Building APIs with NodeJS on Microsoft Azure Websites - Redmond
Building APIs with NodeJS on Microsoft Azure Websites - RedmondBuilding APIs with NodeJS on Microsoft Azure Websites - Redmond
Building APIs with NodeJS on Microsoft Azure Websites - RedmondRick G. Garibay
 
Exploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScriptExploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScriptwesley chun
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersJavan Rasokat
 
Hybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKitHybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKitAriya Hidayat
 
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...DataStax Academy
 
Introduction to Cloud Computing with Google Cloud
Introduction to Cloud Computing with Google CloudIntroduction to Cloud Computing with Google Cloud
Introduction to Cloud Computing with Google Cloudwesley chun
 
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 202010 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020Matt Raible
 

Similar a Backend, app e internet das coisas com NodeJS no Google Cloud Platform (20)

OpenStack API's and WSGI
OpenStack API's and WSGIOpenStack API's and WSGI
OpenStack API's and WSGI
 
Spark on Dataproc - Israel Spark Meetup at taboola
Spark on Dataproc - Israel Spark Meetup at taboolaSpark on Dataproc - Israel Spark Meetup at taboola
Spark on Dataproc - Israel Spark Meetup at taboola
 
Real World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS ApplicationReal World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS Application
 
Django deployment with PaaS
Django deployment with PaaSDjango deployment with PaaS
Django deployment with PaaS
 
Hybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKitHybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKit
 
Hybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKitHybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKit
 
Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010
 
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
 
Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)
 
Building production-quality apps with Node.js
Building production-quality apps with Node.jsBuilding production-quality apps with Node.js
Building production-quality apps with Node.js
 
Dev fest 2020 taiwan how to debug microservices on kubernetes as a pros (ht...
Dev fest 2020 taiwan   how to debug microservices on kubernetes as a pros (ht...Dev fest 2020 taiwan   how to debug microservices on kubernetes as a pros (ht...
Dev fest 2020 taiwan how to debug microservices on kubernetes as a pros (ht...
 
Building APIs with NodeJS on Microsoft Azure Websites - Redmond
Building APIs with NodeJS on Microsoft Azure Websites - RedmondBuilding APIs with NodeJS on Microsoft Azure Websites - Redmond
Building APIs with NodeJS on Microsoft Azure Websites - Redmond
 
Exploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScriptExploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScript
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA Testers
 
Node azure
Node azureNode azure
Node azure
 
Hybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKitHybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKit
 
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
 
Introduction to Cloud Computing with Google Cloud
Introduction to Cloud Computing with Google CloudIntroduction to Cloud Computing with Google Cloud
Introduction to Cloud Computing with Google Cloud
 
JBoss World 2010
JBoss World 2010JBoss World 2010
JBoss World 2010
 
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 202010 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
 

Más de Alvaro Viebrantz

BigQuery Performance Improvements Storage API
BigQuery Performance Improvements Storage APIBigQuery Performance Improvements Storage API
BigQuery Performance Improvements Storage APIAlvaro Viebrantz
 
End to End IoT projects with Zephyr.pdf
End to End IoT projects with Zephyr.pdfEnd to End IoT projects with Zephyr.pdf
End to End IoT projects with Zephyr.pdfAlvaro Viebrantz
 
Carreira de Desenvolvimento
Carreira de DesenvolvimentoCarreira de Desenvolvimento
Carreira de DesenvolvimentoAlvaro Viebrantz
 
Construindo aplicações Cloud Native em Go
Construindo aplicações Cloud Native em GoConstruindo aplicações Cloud Native em Go
Construindo aplicações Cloud Native em GoAlvaro Viebrantz
 
Prototipação em hackathons
Prototipação em hackathonsPrototipação em hackathons
Prototipação em hackathonsAlvaro Viebrantz
 
Building REST APIs using gRPC and Go
Building REST APIs using gRPC and GoBuilding REST APIs using gRPC and Go
Building REST APIs using gRPC and GoAlvaro Viebrantz
 
TinyML - IoT e Machine Learning
TinyML -  IoT e Machine LearningTinyML -  IoT e Machine Learning
TinyML - IoT e Machine LearningAlvaro Viebrantz
 
O que projetos de IoT precisam ?
O que projetos de IoT precisam ?O que projetos de IoT precisam ?
O que projetos de IoT precisam ?Alvaro Viebrantz
 
Ambiente de CI/CD com Google Cloud
Ambiente de CI/CD com Google CloudAmbiente de CI/CD com Google Cloud
Ambiente de CI/CD com Google CloudAlvaro Viebrantz
 
Big Query - Escalabilidade Infinita para os seus Dados
Big Query  - Escalabilidade Infinita para os seus DadosBig Query  - Escalabilidade Infinita para os seus Dados
Big Query - Escalabilidade Infinita para os seus DadosAlvaro Viebrantz
 
Rodando uma API Com Django Rest Framework no Google Cloud
Rodando uma API Com Django Rest Framework  no Google CloudRodando uma API Com Django Rest Framework  no Google Cloud
Rodando uma API Com Django Rest Framework no Google CloudAlvaro Viebrantz
 
Edge computing na prática com IoT, Machine Learning e Google Cloud
Edge computing na prática com IoT, Machine Learning e Google CloudEdge computing na prática com IoT, Machine Learning e Google Cloud
Edge computing na prática com IoT, Machine Learning e Google CloudAlvaro Viebrantz
 
Edge computing in practice using IoT, Tensorflow and Google Cloud
Edge computing in practice using IoT, Tensorflow and Google CloudEdge computing in practice using IoT, Tensorflow and Google Cloud
Edge computing in practice using IoT, Tensorflow and Google CloudAlvaro Viebrantz
 
Iniciando com LoRa, The Things Network e Google Cloud
Iniciando com LoRa, The Things Network e Google CloudIniciando com LoRa, The Things Network e Google Cloud
Iniciando com LoRa, The Things Network e Google CloudAlvaro Viebrantz
 
Construindo projetos para o Google Assistant - I/O 2019 Recap São Paulo
Construindo projetos para o Google Assistant - I/O 2019 Recap São PauloConstruindo projetos para o Google Assistant - I/O 2019 Recap São Paulo
Construindo projetos para o Google Assistant - I/O 2019 Recap São PauloAlvaro Viebrantz
 
Edge computing na prática com IoT, Machine Learning e Google Cloud
Edge computing na prática com IoT, Machine Learning e Google CloudEdge computing na prática com IoT, Machine Learning e Google Cloud
Edge computing na prática com IoT, Machine Learning e Google CloudAlvaro Viebrantz
 
Construindo projetos com Google Assistant e IoT
Construindo projetos com Google Assistant e IoTConstruindo projetos com Google Assistant e IoT
Construindo projetos com Google Assistant e IoTAlvaro Viebrantz
 
Explorando Go em Ambiente Embarcado
Explorando Go em Ambiente EmbarcadoExplorando Go em Ambiente Embarcado
Explorando Go em Ambiente EmbarcadoAlvaro Viebrantz
 
Soluções de IoT usando Arduino e Google Cloud
Soluções de IoT usando Arduino e Google CloudSoluções de IoT usando Arduino e Google Cloud
Soluções de IoT usando Arduino e Google CloudAlvaro Viebrantz
 
Soluções de IoT usando Google Cloud e Firebase
Soluções de IoT usando Google Cloud e FirebaseSoluções de IoT usando Google Cloud e Firebase
Soluções de IoT usando Google Cloud e FirebaseAlvaro Viebrantz
 

Más de Alvaro Viebrantz (20)

BigQuery Performance Improvements Storage API
BigQuery Performance Improvements Storage APIBigQuery Performance Improvements Storage API
BigQuery Performance Improvements Storage API
 
End to End IoT projects with Zephyr.pdf
End to End IoT projects with Zephyr.pdfEnd to End IoT projects with Zephyr.pdf
End to End IoT projects with Zephyr.pdf
 
Carreira de Desenvolvimento
Carreira de DesenvolvimentoCarreira de Desenvolvimento
Carreira de Desenvolvimento
 
Construindo aplicações Cloud Native em Go
Construindo aplicações Cloud Native em GoConstruindo aplicações Cloud Native em Go
Construindo aplicações Cloud Native em Go
 
Prototipação em hackathons
Prototipação em hackathonsPrototipação em hackathons
Prototipação em hackathons
 
Building REST APIs using gRPC and Go
Building REST APIs using gRPC and GoBuilding REST APIs using gRPC and Go
Building REST APIs using gRPC and Go
 
TinyML - IoT e Machine Learning
TinyML -  IoT e Machine LearningTinyML -  IoT e Machine Learning
TinyML - IoT e Machine Learning
 
O que projetos de IoT precisam ?
O que projetos de IoT precisam ?O que projetos de IoT precisam ?
O que projetos de IoT precisam ?
 
Ambiente de CI/CD com Google Cloud
Ambiente de CI/CD com Google CloudAmbiente de CI/CD com Google Cloud
Ambiente de CI/CD com Google Cloud
 
Big Query - Escalabilidade Infinita para os seus Dados
Big Query  - Escalabilidade Infinita para os seus DadosBig Query  - Escalabilidade Infinita para os seus Dados
Big Query - Escalabilidade Infinita para os seus Dados
 
Rodando uma API Com Django Rest Framework no Google Cloud
Rodando uma API Com Django Rest Framework  no Google CloudRodando uma API Com Django Rest Framework  no Google Cloud
Rodando uma API Com Django Rest Framework no Google Cloud
 
Edge computing na prática com IoT, Machine Learning e Google Cloud
Edge computing na prática com IoT, Machine Learning e Google CloudEdge computing na prática com IoT, Machine Learning e Google Cloud
Edge computing na prática com IoT, Machine Learning e Google Cloud
 
Edge computing in practice using IoT, Tensorflow and Google Cloud
Edge computing in practice using IoT, Tensorflow and Google CloudEdge computing in practice using IoT, Tensorflow and Google Cloud
Edge computing in practice using IoT, Tensorflow and Google Cloud
 
Iniciando com LoRa, The Things Network e Google Cloud
Iniciando com LoRa, The Things Network e Google CloudIniciando com LoRa, The Things Network e Google Cloud
Iniciando com LoRa, The Things Network e Google Cloud
 
Construindo projetos para o Google Assistant - I/O 2019 Recap São Paulo
Construindo projetos para o Google Assistant - I/O 2019 Recap São PauloConstruindo projetos para o Google Assistant - I/O 2019 Recap São Paulo
Construindo projetos para o Google Assistant - I/O 2019 Recap São Paulo
 
Edge computing na prática com IoT, Machine Learning e Google Cloud
Edge computing na prática com IoT, Machine Learning e Google CloudEdge computing na prática com IoT, Machine Learning e Google Cloud
Edge computing na prática com IoT, Machine Learning e Google Cloud
 
Construindo projetos com Google Assistant e IoT
Construindo projetos com Google Assistant e IoTConstruindo projetos com Google Assistant e IoT
Construindo projetos com Google Assistant e IoT
 
Explorando Go em Ambiente Embarcado
Explorando Go em Ambiente EmbarcadoExplorando Go em Ambiente Embarcado
Explorando Go em Ambiente Embarcado
 
Soluções de IoT usando Arduino e Google Cloud
Soluções de IoT usando Arduino e Google CloudSoluções de IoT usando Arduino e Google Cloud
Soluções de IoT usando Arduino e Google Cloud
 
Soluções de IoT usando Google Cloud e Firebase
Soluções de IoT usando Google Cloud e FirebaseSoluções de IoT usando Google Cloud e Firebase
Soluções de IoT usando Google Cloud e Firebase
 

Último

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...DianaGray10
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
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 FresherRemote DBA Services
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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, Adobeapidays
 
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...apidays
 
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
 
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
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
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 2024Rafal Los
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
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
 
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
 

Último (20)

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...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
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...
 
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...
 
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
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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
 
+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...
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
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
 

Backend, app e internet das coisas com NodeJS no Google Cloud Platform

  • 1. Backend, App e Internet das Coisas com NodeJS e Google Cloud Platform Alvaro Viebrantz aviebrantz.com.br @alvaroviebrantz medium.com/iot-bootcamp 1
  • 2. Alvaro Viebrantz DevMT e GDGCuiabá Fullstack developer aviebrantz.com.br // @alvaroviebrantz medium.com/iot-bootcamp 2
  • 3. Agenda • O que é computação em nuvem. • Google Cloud Platform Overview. • NodeJS • Estudo de Caso - PacktPub Notifier • Backend - Google App Engine • App - React Native + Firebase • IoT - Alexa Custom Skill 3
  • 4. 4
  • 7. 12anos Internet Smartphones / Nuvem / Mobile 7
  • 8. “The more advanced we become the faster we become at advancing” "Marco Annunziata: Welcome to the Age of the Industrial Internet"8
  • 9. 9
  • 10. 10
  • 11. 4.7 bilhões de página A Web é gigante hoje Era do Zetabyte* * 1000 Exabytes 36.000 anos de video em hd Últimos 20anos http://www.livescience.com/54094-how-big-is-the-internet.html 11
  • 12. Nossa noção de sucesso mudou… 12
  • 13. 13
  • 14. 14
  • 16. 16
  • 17. Como isso é possível ? 17
  • 18. 18
  • 19. 19
  • 22. 22
  • 23. Porque Google Cloud Platform ? 23
  • 24. O Google Cloud Platform é construído na mesma infraestrutura que os serviços do google rodam • Rede Global • Redundância • Infraestrutura inovadora 24
  • 25. 25
  • 27. Vantagens Preço (Cobrança por minuto) Maquinas Customizáveis
 (até GPU) Facilmente Escalável Developer Experience ❤ 27
  • 28. 28
  • 29. 29
  • 31. Estudo de Caso PacktPub Notifier Backend App IoT 31
  • 32. 32
  • 33. Node.js • Engine V8 do Google Chrome • Rápido e escalável • Orientado a eventos e não bloqueante • Muito leve • Perfeito para aplicações real-time 33
  • 34. É apenas Javascript • Navegador • Server side • Desktop - Electron e NW • Mobile - Cordova, Ionic, React Native, etc. • Embarcado - Mongoose OS e Espruino • Geladeira, torradeira, etc 34
  • 35. Ecossistema rico • Muitas ferramentas feitas com Node • Webpack ❤ • Gerenciadores de pacotes • NPM e Yarn • Editores • Visual Studio Code, Atom, Webstorm • Mais de 450 mil pacotes no npmjs.com 35
  • 36. Web Frameworks • Express.js • Hapi.js • Koa 36
  • 37. Stack escolhido • Hapi.js no Backend • Aplicativos iOS e Android nativos com React Native • Vários serviços do GCP • Database, Cron, Tasks, HTTPS, etc 37
  • 38. PacktPub Notifier v0.1 iOS e Android Packt Publishing Website Backend 38
  • 39. Hello World com HapiJS const Hapi = require('hapi'); const server = new Hapi.Server(); server.connection({ host: '0.0.0.0', port: process.env.PORT || 8080 }); server.route({ method: 'GET', path: '/api/tasks/fetch-books', config: { handler: (request, reply) => { reply({ message: 'Hello World'}) } } }); server.start((err) => { if (err) { throw err; } }); 39
  • 40. Web Scrapping 'use strict'; const cheerio = require('cheerio'); const fetch = require('node-fetch'); const urlFreeLearning = 'http://www.packtpub.com/packt/offers/free-learning/'; class PackPubCrawler { /* Código omitido */ async fetchBooksFromPacktPub() { let body = await this.fetchPageBody(); let documentSelector = cheerio.load(body); let currentBook = this.scrapeCurrentBook(documentSelector); return { currentBook }; } } module.exports = PackPubCrawler; 40
  • 41. Api de Livros 'use strict'; const Boom = require('boom'); const PackPubCrawler = require('../PacktPubCrawler'); module.exports = { method: 'GET', path: '/api/books', config: { handler: async (request, reply) => { try { const crawler = new PackPubCrawler(); let books = await crawler.fetchBooksFromPacktPub(); console.log('Success Fetching Books'); reply({ books }); } catch (e) { console.log('Error Fetching Books', e); reply(Boom.badGateway('Xablau', e)) } } } } 41
  • 43. 43
  • 44. Nuvem IaaS
 Infrastructre as a Service CaaS
 Container/Cluster as a Service PaaS
 Platform as a Service SaaS
 Software as a Service GoogleVocê 44
  • 45. Nuvem IaaS
 Infrastructre as a Service On Premise PaaS
 Platform as a Service SaaS
 Software as a Service • Aplicação • Dados • Runtime • Middleware • SO • Virtualização • Servidores • Storage • Redes • Aplicação • Dados • Runtime • Middleware • SO • Virtualização • Servidores • Storage • Redes • Aplicação • Dados • Runtime • Middleware • SO • Virtualização • Servidores • Storage • Redes • Aplicação • Dados • Runtime • Middleware • SO • Virtualização • Servidores • Storage • Redes Gerenciado por você Gerenciado magicamente45
  • 46. Google App Engine - Standard vs Flexible 46
  • 47. 47
  • 48. 48
  • 50. 1. Instale o Cloud SDK (cli) 2. Configure o app.yaml 3. cloud app deploy https://cloud.google.com/sdk/ runtime: nodejs env: flex skip_files: - ^node_modules$ resources: cpu: .5 memory_gb: .6 disk_size_gb: 10 manual_scaling: instances: 1 #automatic_scaling: # min_num_instances: 1 # max_num_instances: 1 # cool_down_period_sec: 120 # cpu_utilization: # target_utilization: 0.8 50
  • 53. PacktPub Notifier v0.2 iOS e Android Packt Publishing Website Storage
 Database 53
  • 54. We need a database 54
  • 55. NoSQL escolhido - Flexibilidade 55
  • 56. Serviço de Livros - Salvando const Datastore = require('@google-cloud/datastore'); // Instantiates a client const datastore = Datastore({ projectId: config.projectId }); const kind = 'Book'; class BookService { /* Codigo omitido */ async save(book) { let slug = this.getSlug(book); book.slug = slug; const bookKey = datastore.key([kind, slug]); let bookEntity = { key: bookKey, data: book }; return datastore.save(bookEntity); } } 56
  • 57. Serviço de Livros - Consulta // The kind for the new entity const kind = 'Book'; class BookService { /* Codigo omitido */ async all() { const query = datastore.createQuery(kind) .order('date', { descending: true }); let results = await datastore.runQuery(query); return results[0]; } } 57
  • 58. API de tarefa de busca e armazenamento de livros module.exports = { method: 'GET', path: '/api/tasks/fetch-books', config: { handler: async (request, reply) => { const crawler = new PackPubCrawler(); let books = await crawler.fetchBooksFromPacktPub(); const service = new BooksService(); let slug = service.getSlug(books.currentBook); let exists = await service.exists(slug); if (!exists) { // Save new book await service.save(books.currentBook); //TODO: Notify clients that subscribed to this } reply({ books }); } } } 58
  • 59. API de Livros const BooksService = require('../BooksService'); module.exports = { method: 'GET', path: '/api/books', config: { handler: async (request, reply) => { let service = new BooksService(); let books = await service.all(); reply({ books }); } } } 59
  • 62. PacktPub Notifier v0.2 iOS e Android Packt Publishing Website 62
  • 63. Agendamento de tarefas Como fazer em ambiente distribuido ? 63
  • 65. Agendamento de tarefas - Gambiarra 65
  • 66. 1. Sintaxe do unix cron ou mais natural 2. Configure um cron.yaml 3. cloud app deploy cron.yaml Google App Engine - cron.yaml cron: - description: fetch book every 30 mins url: /api/tasks/fetch-books schedule: every 30 mins target: default 66
  • 67. Google App Engine - cron.yaml 67
  • 68. Google App Engine - Logs, monitoramento e trace 1. Pacote @google/cloud-trace 2. Just works if (process.env.NODE_ENV === 'production') { require('@google/cloud-trace').start(); } 68
  • 69. Google App Engine - Logs, monitoramento e trace 69
  • 70. Google App Engine - Logs, monitoramento e trace 70
  • 71. PacktPub Notifier v0.5 iOS e Android Packt Publishing Website 71
  • 72. Push Notifications 72% Abrem o app quando recebe uma notificação 72
  • 73. Fluxo Push Notifications Android iOS Backend GCM APNS Device Token 73
  • 74. 74
  • 75. 75
  • 76. const admin = require("firebase-admin"); let credential = admin.credential.applicationDefault(); admin.initializeApp({ credential, databaseURL: "https://iot-bootcamp-158521.firebaseio.com" }); const messaging = admin.messaging(); const TOPIC_NAME = 'receive_book_notification'; class BookNotificationService { async notifyAllClients(book) { var payload = { notification: { title: `${book.title} is free today!`, body: `Open the app to claim this book.` } }; return messaging.sendToTopic(TOPIC_NAME, payload); } } Firebase Admin SDK 76
  • 77. Client Side - React Native import Firestack from 'react-native-firestack'; import FCM from 'react-native-fcm'; const TOPIC_NAME = 'receive_book_notification'; async subscribe() { let { wantsToReceiveNotifications } = this.state; if (!wantsToReceiveNotifications) { FCM.requestPermissions(); FCM.subscribeToTopic(TOPIC_NAME); firestack.analytics.logEventWithName('subscribe', {}); } else { FCM.unsubscribeFromTopic(TOPIC_NAME); firestack.analytics.logEventWithName('unsubscribe', {}); } this.setState({ wantsToReceiveNotifications: ! wantsToReceiveNotifications }) } 77
  • 79. iOS e Android PacktPub Notifier v0.8 Packt Publishing Website 79
  • 80. 80
  • 81. Fluxo Alexa Custom Skill Backend Usuário Alexa, Ask Packt Publishing Fan what’s the book of the day The free book of the day is title Learning Raspberry Pi Alexa Skill HTTPS 81
  • 82. Api de integração com a Alexa const BooksService = require('../BooksService'); module.exports = { method: 'POST', path: '/api/alexa', config: { handler: async (request, reply) => { let service = new BooksService(); let book = await service.getLastBook(); let message = `The free book of the day is titled $ {book.title}`; reply({ "version": "1.0", "sessionAttributes": {}, "response": { "shouldEndSession": true, "outputSpeech": { "type": "SSML", "ssml": `<speak>${message}</speak>` }, } }); } } } 82
  • 83. PacktPub Notifier - Final iOS e Android Amazon Echo Alexa Custom Skill Packt Publishing Website 83
  • 85. • Funções escritas em NodeJS • Escalabilidade automatica • Serverless • Podem ser chamadas por eventos • Mudanças de arquivo, banco, http, etc. 85
  • 88. Links úteis • https://cloud.google.com/sdk/ • https://developers.google.com • https://cloud.google.com/products/ • https://firebase.google.com • https://nodejs.org/en/ • https://developer.amazon.com • https://facebook.github.io/react-native/ 88