Download - Construindo um Servidor Web com GO
![Page 1: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/1.jpg)
CONSTRUINDO UM SERVIDOR WEB COM GO
And there we GO…
![Page 2: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/2.jpg)
Sou Beto MunizTenho 21 anos e sou um mineiro-capixaba.
E trabalho na Tagon8 Inc.
![Page 4: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/4.jpg)
Mas porque usar Go Lang para um Servidor Web?
?expressjs.com
![Page 5: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/5.jpg)
Fácil Aprendizado
![Page 6: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/6.jpg)
Ótima para Single Page Applications
![Page 7: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/7.jpg)
goroutines
goroutine é tipo de função capaz de ser executada
simultaneamente com outras funções, ou seja, de forma
assíncrona.
![Page 8: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/8.jpg)
Fácil implementação de Concorrência
![Page 9: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/9.jpg)
Ótimas biblioteca nativa de componentes
![Page 10: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/10.jpg)
Incrível Biblioteca HTTP
![Page 11: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/11.jpg)
Desenvolvimento baseado em componentes* (*semelhante aos módulos de NodeJS)
![Page 12: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/12.jpg)
Desenvolvimento baseado em componentes semelhante aos módulos de NodeJS e não
grandes frameworks “engessados”
![Page 13: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/13.jpg)
Mantido pela Google
O que de certa forma garante bastante qualidade, visibilidade e
ótimos contribuintes para o projeto
![Page 14: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/14.jpg)
Performance comparada a NodeJS e por vezes saindo melhor que NodeJS.
![Page 15: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/15.jpg)
NodeJS vs. Go : HttpRequests
![Page 16: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/16.jpg)
NodeJS vs. Go : Simulação de Gargalo com Redis
![Page 17: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/17.jpg)
OK!…mas só vi blahblahblah…E o código?
!!
@,@
![Page 18: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/18.jpg)
…Um exemplo de uma aplicação web
![Page 19: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/19.jpg)
Estrutura mínima de pastas para criação do nosso servidor
![Page 20: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/20.jpg)
Iniciando nosso arquivo todos.go
![Page 21: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/21.jpg)
Importando pacotes necessários para rodar um servidor web com view engine HTML
![Page 22: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/22.jpg)
Declarando a função que servirá de construtora e que também será onde todas as configuração de
rotas, porta, arquivos estáticos da aplicação estarão.
![Page 23: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/23.jpg)
Bônus: Stub da API que nossa applicação irá consumir
![Page 24: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/24.jpg)
Todo List App
![Page 25: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/25.jpg)
Demo Time
![Page 26: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/26.jpg)
E é isso…Dúvidas? Algo a acrescentar na talk?
!IT’S TIME!
![Page 27: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/27.jpg)
FIMObrigado pela presença de todos.
![Page 28: Construindo um Servidor Web com GO](https://reader033.vdocuments.pub/reader033/viewer/2022052211/559314c11a28abe55f8b457a/html5/thumbnails/28.jpg)
Referências
http://www.golangbr.org/doc/
http://go-tour-br.appspot.com/#1
http://goporexemplo.pistach.es/
http://www.golangbr.org/
http://www.polydaic.com/blog/go-vs-node-js
http://golang.org/doc/articles/wiki/