<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sergio Lima</title>
    <description>The latest articles on DEV Community by Sergio Lima (@sergiosouzalima).</description>
    <link>https://dev.to/sergiosouzalima</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F36285%2F3bcf9299-cc3e-4d73-bd0f-4166a86fbd06.png</url>
      <title>DEV Community: Sergio Lima</title>
      <link>https://dev.to/sergiosouzalima</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sergiosouzalima"/>
    <language>en</language>
    <item>
      <title>Prescrição SQL: A Linguagem SQL Ajudando na Gestão Hospitalar</title>
      <dc:creator>Sergio Lima</dc:creator>
      <pubDate>Sat, 10 Jun 2023 13:24:21 +0000</pubDate>
      <link>https://dev.to/sergiosouzalima/prescricao-sql-a-linguagem-sql-ajudando-na-gestao-hospitalar-2bi8</link>
      <guid>https://dev.to/sergiosouzalima/prescricao-sql-a-linguagem-sql-ajudando-na-gestao-hospitalar-2bi8</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VGAoj9Aq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h3bnt81j2o3rtvwv2e7x.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VGAoj9Aq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h3bnt81j2o3rtvwv2e7x.jpg" alt="Image description" width="786" height="788"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introdução: Minha Experiência com SQL em Ambientes Hospitalares
&lt;/h2&gt;

&lt;p&gt;Este artigo é inspirado em minha experiência profissional com a linguagem SQL em ambientes hospitalares. Os cenários descritos são semelhantes a casos reais, demonstrando a aplicação prática da SQL na gestão de dados hospitalares.&lt;/p&gt;

&lt;p&gt;As consultas SQL apresentadas são exemplos ilustrativos. Elas podem não funcionar em bancos de dados reais sem as devidas adaptações, mas servem para demonstrar o tipo de análise que pode ser realizada.&lt;/p&gt;

&lt;p&gt;A eficácia dessas consultas depende de uma base de dados estruturada. Idealmente, um hospital deve ter uma arquitetura de Data Warehouse para que essas consultas de alto nível funcionem apropriadamente.&lt;/p&gt;

&lt;p&gt;Para gestores hospitalares, um Data Warehouse oferece uma visão integrada e histórica dos dados. Isso facilita decisões estratégicas e melhora a eficiência operacional, levando a melhores resultados para os pacientes.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Presença Crescente da SQL na Medicina
&lt;/h2&gt;

&lt;p&gt;A linguagem SQL vem se estabelecendo como um instrumento essencial na administração de dados em instituições de saúde, acompanhando a crescente inserção da tecnologia em todas as áreas da medicina. Neste texto, vamos explorar como a SQL pode ser aplicada para a obtenção de estatísticas cruciais a partir de bancos de dados hospitalares, demonstrando por meio de exemplos reais.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Força dos Dados em Ambientes Hospitalares
&lt;/h2&gt;

&lt;p&gt;As instituições de saúde produzem uma quantidade massiva de dados, desde detalhes do paciente até registros de equipamentos. Quando devidamente estruturados e interpretados, esses dados podem proporcionar percepções preciosas que podem conduzir a um aumento na eficiência operacional e aprimoramentos nos resultados dos pacientes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exemplos Práticos de SQL na Gestão Hospitalar
&lt;/h2&gt;

&lt;p&gt;A SQL pode ser usada para calcular a taxa de ocupação de leitos, a incidência de infecções hospitalares, a utilização de equipamentos de alto custo e o número de leitos ocupados. Aqui estão algumas consultas SQL que poderiam ser usadas para esses fins:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT AVG(DATEDIFF(data_de_alta, data_de_internacao)) AS 'Tempo Médio de Permanência (dias)' FROM Internacoes;
SELECT COUNT(*) AS 'Número de Infecções Hospitalares' FROM Incidentes WHERE tipo_incidente = 'Infecção Hospitalar';
SELECT COUNT(*) AS 'Número de Leitos Ocupados' FROM Leitos WHERE status = 'Ocupado';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Prestação de Contas e Regulação
&lt;/h2&gt;

&lt;p&gt;Organizações hospitalares devem prestar contas a diversos órgãos regulares. &lt;/p&gt;

&lt;p&gt;No Brasil, algumas dessas agências reguladores são a ANS (Agência Nacional de Saúde Suplementar) e a ANVISA (Agência Nacional de Vigilância Sanitária). &lt;/p&gt;

&lt;p&gt;Administradores encarregados dessa função, devem ter à disposição banco de dados eficientes e com o uso da SQL, podem ter relatórios úteis para prestação de contas à essas agências.&lt;/p&gt;

&lt;h2&gt;
  
  
  SQL na Prestação de Contas em Hospitais Universitários e Privados
&lt;/h2&gt;

&lt;p&gt;Hospitais universitários, por exemplo, podem precisar reportar a quantidade de procedimentos realizados por alunos ou residentes. Hospitais privados, por outro lado, podem precisar demonstrar lucratividade para seus acionistas. Aqui estão algumas consultas SQL que poderiam ser usadas para esses fins:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT COUNT(*) AS 'Número de Procedimentos Realizados por Alunos' FROM Procedimentos WHERE tipo_executante = 'Aluno';
SELECT SUM(valor_pago) - SUM(custo_procedimento) AS 'Lucratividade' FROM Procedimentos;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  A Influência da SQL na Gestão Hospitalar
&lt;/h2&gt;

&lt;p&gt;O poder da SQL em hospitais vai além do simples rastreamento e relatório de dados. Quando utilizada corretamente, pode ser uma ferramenta poderosa para melhorar a eficiência operacional, a qualidade do atendimento ao paciente e a tomada de decisões estratégicas.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusão
&lt;/h2&gt;

&lt;p&gt;Como você pode ver, a SQL é uma ferramenta poderosa que pode ser usada para transformar a gestão de dados em hospitais. E você, como está utilizando a SQL no seu setor? Compartilhe suas experiências.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fontes:
&lt;/h2&gt;

&lt;p&gt;SQL:&lt;br&gt;
&lt;a href="https://pt.wikipedia.org/wiki/SQL"&gt;https://pt.wikipedia.org/wiki/SQL&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Gestão Hospitalar:&lt;br&gt;
&lt;a href="https://pt.wikipedia.org/wiki/Gest%C3%A3o_hospitalar"&gt;https://pt.wikipedia.org/wiki/Gest%C3%A3o_hospitalar&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Infecções Hospitalares:&lt;br&gt;
&lt;a href="https://pt.wikipedia.org/wiki/Infec%C3%A7%C3%A3o_hospitalar"&gt;https://pt.wikipedia.org/wiki/Infec%C3%A7%C3%A3o_hospitalar&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Data Warehouse (Armazém de Dados):&lt;br&gt;
&lt;a href="https://pt.wikipedia.org/wiki/Data_warehouse"&gt;https://pt.wikipedia.org/wiki/Data_warehouse&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Os links exibidos acima, são minhas indicações como leituras adicionais. &lt;br&gt;
Recomendo a leitura sobre Data Warehouse se existir interesse em compreender como bancos de dados podem ser estruturados para uma análise de dados hospitalares com eficiência.&lt;/p&gt;

</description>
      <category>data</category>
      <category>datawarehouse</category>
      <category>sql</category>
      <category>datascience</category>
    </item>
    <item>
      <title>Usando SQL em Diversos Setores: Um Olhar Detalhado</title>
      <dc:creator>Sergio Lima</dc:creator>
      <pubDate>Sun, 21 May 2023 20:10:34 +0000</pubDate>
      <link>https://dev.to/sergiosouzalima/usando-sql-em-diversos-setores-um-olhar-detalhado-2eg3</link>
      <guid>https://dev.to/sergiosouzalima/usando-sql-em-diversos-setores-um-olhar-detalhado-2eg3</guid>
      <description>&lt;p&gt;Nos últimos 50 anos, a tecnologia da informação transformou quase todos os aspectos da nossa vida. Neste cenário, a linguagem SQL (Structured Query Language) tem se destacado como uma ferramenta poderosa e indispensável na manipulação e consulta de dados. &lt;/p&gt;

&lt;p&gt;SQL foi desenvolvida originalmente no início dos anos 70 nos laboratórios da IBM em San Jose, dentro do projeto System R, que tinha por objetivo demonstrar a viabilidade da implementação do modelo relacional proposto por E. F. Codd. O nome original da linguagem era SEQUEL, acrônimo para "Structured English Query Language" (Linguagem de Consulta Estruturada, em Inglês), e essa origem reflete na pronúncia comum da sigla até hoje. &lt;/p&gt;

&lt;p&gt;A linguagem é um grande padrão de banco de dados devido à sua simplicidade e facilidade de uso. Ela se diferencia de outras linguagens de consulta a banco de dados no sentido em que uma consulta SQL especifica a forma do resultado e não o caminho para chegar a ele. SQL é uma linguagem de programação feita para armazenar e processar informações de um banco de dados relacional (baseado em tabelas), sendo uma linguagem declarativa em oposição a outras linguagens procedurais. Isto reduz o ciclo de aprendizado daqueles que se iniciam na linguagem.&lt;/p&gt;

&lt;p&gt;Embora a SQL tenha sido originalmente criada pela IBM, rapidamente surgiram vários "dialetos" desenvolvidos por outros produtores. Essa expansão levou à necessidade de ser criado e adaptado um padrão para a linguagem. Esta tarefa foi realizada pela American National Standards Institute (ANSI) em 1986 e ISO em 1987. A SQL foi revista em 1992 e a esta versão foi dado o nome de SQL-92. Foi revisto novamente em 1999 e 2003 para se tornar SQL:1999 (SQL3) e SQL:2003, respectivamente. &lt;/p&gt;

&lt;p&gt;O poder da SQL reside em sua simplicidade: embora seja uma linguagem com muitos recursos, sua estrutura básica pode ser aprendida em pouco tempo. A versatilidade da SQL é tal que pode ser aplicada em diversos setores, cada um com suas próprias necessidades de informação e desafios únicos. Embora a finalidade da SQL permaneça a mesma – gerenciar dados – o contexto, a aplicação e a implementação podem variar significativamente. &lt;/p&gt;

&lt;p&gt;Na indústria de saúde, por exemplo, a SQL pode ser utilizada para identificar tendências em dados de pacientes, ajudar a rastrear o surto de uma doença, ou simplesmente manter registros de pacientes. No setor financeiro, a SQL é usada para gerenciar transações, monitorar fraudes e gerar relatórios detalhados para órgãos reguladores. &lt;/p&gt;

&lt;p&gt;Seja para acompanhar as vendas diárias de uma loja de varejo ou para analisar grandes conjuntos de dados para pesquisas de saúde, a SQL se provou flexível e robusta o suficiente para enfrentar esses desafios. A lista de aplicações da SQL é tão vasta quanto a variedade de dados disponíveis para serem gerenciados e analisados.&lt;/p&gt;

&lt;p&gt;Iremos aprofundar nossa exploração da SQL, mergulhando em suas variações únicas aplicadas em diferentes sistemas de gerenciamento de banco de dados relacional (RDBMS) - Oracle, SQL Server e PostgreSQL. Cada um desses sistemas, embora baseado no padrão SQL, implementa a linguagem de uma maneira específica e otimizada para seus recursos e funcionalidades específicas. &lt;/p&gt;

&lt;p&gt;Nestas próximas seções, vamos explorar como a SQL é usada em diferentes indústrias, desde tecnologia e saúde até finanças e varejo, destacando como essa linguagem essencial ajuda a impulsionar a inovação e a eficiência em cada setor.&lt;/p&gt;

&lt;h3&gt;
  
  
  Compliance em Detalhe
&lt;/h3&gt;

&lt;p&gt;No setor tecnológico, particularmente na indústria de serviços financeiros, o compliance desempenha um papel crítico. Transações de ações, em particular, são sujeitas a uma variedade de regulamentos e precisam ser monitoradas de perto para prevenir e detectar atividades ilícitas. SQL é uma ferramenta poderosa para esse fim, permitindo a rápida recuperação e análise de dados para gerar relatórios de compliance. Vamos explorar algumas situações de exemplo:&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Detectando possíveis atividades de insider trading
&lt;/h4&gt;

&lt;p&gt;Insider trading é um crime sério e pode ser difícil de detectar. Através da análise de padrões de transações, entretanto, é possível identificar comportamentos suspeitos.&lt;/p&gt;

&lt;p&gt;Por exemplo, no Oracle, você poderia usar uma consulta como esta para encontrar transações de ações que ocorreram pouco antes de um anúncio de grande notícia:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT ST.TraderID, ST.TransactionDate, ST.Amount
FROM StockTransactions ST
JOIN CompanyAnnouncements CA 
ON ST.StockID = CA.StockID 
AND CA.AnnouncementDate BETWEEN ST.TransactionDate AND ST.TransactionDate + INTERVAL '7' DAY
WHERE ST.Amount &amp;gt; 10000
ORDER BY ST.TransactionDate DESC;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Esta consulta seleciona todas as transações de ações com um valor maior que R$ 10.000,00 que ocorreram dentro de uma semana antes de um anúncio da empresa.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Monitorando volume de transações anormalmente alto
&lt;/h4&gt;

&lt;p&gt;Um volume de transações anormalmente alto para uma determinada ação (stock) pode ser um sinal de atividade de mercado irregular. No SQL Server, você pode usar a função de agregação SUM para calcular o volume total de transações para cada ação em um determinado período de tempo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT StockID, TraderID, SUM(Amount) AS TotalVolume
FROM StockTransactions
WHERE TransactionDate BETWEEN '2023-01-01' AND '2023-12-31'
GROUP BY StockID, TraderID
HAVING SUM(Amount) &amp;gt; (SELECT AVG(Amount) * 2 FROM StockTransactions)
ORDER BY TotalVolume DESC;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Esta consulta retorna todas as ação que tiveram um volume de transações total mais de duas vezes maior que a média no ano de 2023.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Identificando transações rápidas e consecutivas (churning)
&lt;/h4&gt;

&lt;p&gt;Churning, ou a prática de comprar e vender rapidamente a mesma ação (stock), é outra atividade que pode indicar comportamento irregular de mercado. No PostgreSQL, você pode usar a função LEAD para identificar casos em que a mesma ação é comprada e vendida dentro de um curto período de tempo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;WITH TransactionData AS (
    SELECT TraderID, StockID, TransactionDate,
    LEAD(TransactionDate) OVER (PARTITION BY TraderID, StockID ORDER BY TransactionDate) AS NextTransactionDate
    FROM StockTransactions
    WHERE TransactionType = 'BUY'
)
SELECT * FROM TransactionData
WHERE (TransactionData.NextTransactionDate - TransactionData.TransactionDate) &amp;lt;= 1;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Esta consulta retorna todas as transações onde a mesma ação é comprada e vendida pelo mesmo trader em um dia ou menos.&lt;/p&gt;

&lt;p&gt;Em cada um desses casos, a SQL permite que analistas de compliance identifiquem rapidamente possíveis irregularidades e tomem providencias para investigar e resolver a situação.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusão
&lt;/h3&gt;

&lt;p&gt;Enquanto percorremos este caminho, vamos mergulhar em mais detalhes em cada setor. Cada indústria possui suas peculiaridades e requerimentos específicos, e a SQL mostra sua robustez e adaptabilidade para enfrentar esses desafios.&lt;/p&gt;

&lt;p&gt;Ainda estou planejando mas é possível, na próxima edição deste artigo, explorar como a linguagem SQL é utilizada na área de saúde, para gerenciamento de registros de pacientes, análise de tendências de doenças e desenvolvimento de estratégias de tratamento personalizadas.&lt;/p&gt;

&lt;p&gt;Este artigo é o começo de nossa jornada em direção a uma compreensão do papel da SQL na transformação da tecnologia e dos negócios. &lt;/p&gt;

&lt;p&gt;Seu feedback é importante para podermos aprofundar os tópicos de maior interesse para todos. Deixem seus comentários.&lt;/p&gt;

&lt;p&gt;Para ficarem sempre atualizados, sigam meu perfil. Continuaremos a explorar juntos o poder da SQL e como ela molda as operações e estratégias em várias indústrias. &lt;/p&gt;

&lt;p&gt;Espero que esse post seja útil.&lt;/p&gt;




&lt;h4&gt;
  
  
  Fontes:
&lt;/h4&gt;

&lt;p&gt;SQL:&lt;br&gt;
&lt;a href="https://pt.wikipedia.org/wiki/SQL"&gt;https://pt.wikipedia.org/wiki/SQL&lt;/a&gt;&lt;br&gt;
Insider Trading:&lt;br&gt;
&lt;a href="https://www.investor.gov/introduction-investing/investing-basics/glossary/insider-trading"&gt;https://www.investor.gov/introduction-investing/investing-basics/glossary/insider-trading&lt;/a&gt;&lt;br&gt;
Churning:&lt;br&gt;
&lt;a href="https://www.investopedia.com/terms/c/churning.asp"&gt;https://www.investopedia.com/terms/c/churning.asp&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>The New Hello World for faastRuby - The Serverless Platform for Ruby &amp; Crystal - Part 2.</title>
      <dc:creator>Sergio Lima</dc:creator>
      <pubDate>Sat, 13 Apr 2019 20:23:19 +0000</pubDate>
      <link>https://dev.to/sergiosouzalima/the-new-hello-world-for-faastruby-the-serverless-platform-for-ruby-crystal-part-2-29pk</link>
      <guid>https://dev.to/sergiosouzalima/the-new-hello-world-for-faastruby-the-serverless-platform-for-ruby-crystal-part-2-29pk</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ufJ-c-zE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://faastruby.io/wp-content/uploads/2019/03/logo-negative-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ufJ-c-zE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://faastruby.io/wp-content/uploads/2019/03/logo-negative-1.png" alt="alt text" title="faastRuby logo" width="800" height="194"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hi folks! Before we get started, if you have not already read my previous article - The New Hello World for faastRuby. The Serverless Platform for Ruby &amp;amp; Crystal: &lt;a href="https://dev.to/sergiosouzalima/the-new-hello-world-for-faastruby-the-serverless-platform-for-ruby-crystal-part-1-2o95"&gt;Part 1&lt;/a&gt; -  you should definitely give it a look over as we’re going to be building on what we learned there.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are we going to create?
&lt;/h3&gt;

&lt;p&gt;Using the &lt;a href="https://www.faastruby.io"&gt;faastRuby&lt;/a&gt; Platform, we'll create a function in Ruby and make it quickly available on the internet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step by Step Function Creation
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Login
&lt;/h3&gt;

&lt;p&gt;Enter the folder we created earlier &lt;a href="https://dev.to/sergiosouzalima/the-new-hello-world-for-faastruby-the-serverless-platform-for-ruby-crystal-part-1-2o95"&gt;Part 1&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;faastruby
&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Log in with your account you previously created. (&lt;a href="https://dev.to/sergiosouzalima/the-new-hello-world-for-faastruby-the-serverless-platform-for-ruby-crystal-part-1-2o95"&gt;Part 1&lt;/a&gt;).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt;faastruby login       
Email: you@your-email.com
Password: &lt;span class="k"&gt;********&lt;/span&gt;
Login successful.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Creating the Hello World Project
&lt;/h3&gt;

&lt;p&gt;Now let's create our project named, Hello World.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt;faastruby new-project hello-world &lt;span class="nt"&gt;--api&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;em&gt;faastruby new-project&lt;/em&gt; command will create the &lt;em&gt;hello-world&lt;/em&gt; folder with subfolders, static files, and initial functions. You will see the output below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;+ d ./hello-world
+ f ./hello-world/project.yml
+ f ./hello-world/secrets.yml
+ d ./hello-world/functions/root
+ f ./hello-world/functions/root/handler.rb
+ f ./hello-world/functions/root/faastruby.yml
+ d ./hello-world/functions/catch-all
+ f ./hello-world/functions/catch-all/handler.rb
+ f ./hello-world/functions/catch-all/faastruby.yml
+ d ./hello-world/public
+ f ./hello-world/public/faastruby.yml
+ f ./hello-world/.gitignore
Initialized empty Git repository &lt;span class="k"&gt;in&lt;/span&gt; /Users/you/workspace/faastruby/hello-world/.git/
Project &lt;span class="s1"&gt;'hello-world'&lt;/span&gt; initialized.
Now run:
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;hello-world
&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby &lt;span class="nb"&gt;local

&lt;/span&gt;Then visit http://localhost:3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enter into the &lt;em&gt;hello-world&lt;/em&gt; folder we just created.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt; &lt;span class="nb"&gt;cd &lt;/span&gt;hello-world
&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Folder &amp;amp; files explanation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;├── functions &amp;lt;&lt;span class="nt"&gt;----------------&lt;/span&gt; Put your functions inside this directory
│   ├── catch-all &amp;lt;&lt;span class="nt"&gt;------------&lt;/span&gt; This &lt;span class="k"&gt;function &lt;/span&gt;will run when a &lt;span class="k"&gt;function &lt;/span&gt;is not found.
│   │   ├── faastruby.yml
│   │   └── handler.rb
│   └── root &amp;lt;&lt;span class="nt"&gt;-----------------&lt;/span&gt; This &lt;span class="k"&gt;function &lt;/span&gt;will run when a request ie made to the root path &lt;span class="s1"&gt;'/'&lt;/span&gt;
│       ├── faastruby.yml 
│       └── handler.rb
├── project.yml &amp;lt;&lt;span class="nt"&gt;--------------&lt;/span&gt; Project configuration file.
├── public &amp;lt;&lt;span class="nt"&gt;-------------------&lt;/span&gt; Put static files inside this folder.
│   └── faastruby.yml &amp;lt;&lt;span class="nt"&gt;--------&lt;/span&gt; Static files configuration.
└── secrets.yml &amp;lt;&lt;span class="nt"&gt;--------------&lt;/span&gt; Put your secrets here.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Starting faastRuby local
&lt;/h3&gt;

&lt;p&gt;Now let's start the faastRuby local server and check if our project is really working.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/&amp;gt; faastruby &lt;span class="nb"&gt;local&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll see the output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Puma starting &lt;span class="k"&gt;in &lt;/span&gt;single mode...
&lt;span class="k"&gt;*&lt;/span&gt; Version 3.12.1 &lt;span class="o"&gt;(&lt;/span&gt;ruby 2.6.0-p0&lt;span class="o"&gt;)&lt;/span&gt;, codename: Llamas &lt;span class="k"&gt;in &lt;/span&gt;Pajamas
&lt;span class="k"&gt;*&lt;/span&gt; Min threads: 0, max threads: 32
&lt;span class="k"&gt;*&lt;/span&gt; Environment: production
&lt;span class="k"&gt;*&lt;/span&gt; Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
2019-03-23 16:21:23 &lt;span class="nt"&gt;-0300&lt;/span&gt; | Detecting existing functions.
&lt;span class="nt"&gt;---&lt;/span&gt;
2019-03-23 16:21:23 &lt;span class="nt"&gt;-0300&lt;/span&gt; | Ruby functions: &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"root"&lt;/span&gt;, &lt;span class="s2"&gt;"catch-all"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="nt"&gt;---&lt;/span&gt;
2019-03-23 16:21:23 &lt;span class="nt"&gt;-0300&lt;/span&gt; | Crystal functions: &lt;span class="o"&gt;[]&lt;/span&gt;
&lt;span class="nt"&gt;---&lt;/span&gt;
2019-03-23 16:21:23 &lt;span class="nt"&gt;-0300&lt;/span&gt; | Listening &lt;span class="k"&gt;for &lt;/span&gt;changes.
&lt;span class="nt"&gt;---&lt;/span&gt;
2019-03-23 16:21:23 &lt;span class="nt"&gt;-0300&lt;/span&gt; | faastRuby Local is ready at http://localhost:3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, visit &lt;a href=""&gt;http://localhost:3000&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;If everything went well, you now have the &lt;em&gt;root&lt;/em&gt; function response in your browser.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Welcome to FaaStRuby Local! Edit the function 'root' to customize this response.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Creating your first function
&lt;/h3&gt;

&lt;p&gt;Your first function will be called &lt;em&gt;hello&lt;/em&gt; and it will respond in json format with the message "Hello, World!".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: to create functions, you must be inside the &lt;em&gt;functions&lt;/em&gt; folder of your project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/&amp;gt; &lt;span class="nb"&gt;cd &lt;/span&gt;functions
&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/functions/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use &lt;em&gt;faastruby new hello&lt;/em&gt; command to create the &lt;em&gt;hello&lt;/em&gt; function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/functions&amp;gt; faastruby new hello
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;+ d hello
+ d hello/spec
+ f hello/spec/spec_helper.rb
+ f hello/spec/handler_spec.rb
+ f hello/README.md
+ f hello/Gemfile
+ f hello/handler.rb
+ f hello/faastruby.yml
✔ Installing gems...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;em&gt;faastruby new&lt;/em&gt; command, created specific folders and files for your &lt;em&gt;hello&lt;/em&gt; function.&lt;/p&gt;

&lt;p&gt;Let's go inside the &lt;em&gt;hello&lt;/em&gt; folder to implement our solution in Ruby.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/functions/&amp;gt; &lt;span class="nb"&gt;cd &lt;/span&gt;hello
&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/functions/hello/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make the file, &lt;em&gt;handler.rb&lt;/em&gt; look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# hello-world/functions/hello/handler.rb&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'json'&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;handler&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;
  &lt;span class="n"&gt;render&lt;/span&gt; &lt;span class="ss"&gt;json: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s1"&gt;'message'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Hello, World!'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have to modify the unit test:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# hello-world/functions/hello/spec/handler_spec.rb&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'spec_helper'&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'handler'&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'json'&lt;/span&gt;

&lt;span class="n"&gt;describe&lt;/span&gt; &lt;span class="s1"&gt;'#handler'&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="n"&gt;let&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;body&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;let&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="no"&gt;Event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="ss"&gt;body: &lt;/span&gt;&lt;span class="kp"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;query_params: &lt;/span&gt;&lt;span class="p"&gt;{},&lt;/span&gt;
      &lt;span class="ss"&gt;headers: &lt;/span&gt;&lt;span class="p"&gt;{},&lt;/span&gt; &lt;span class="ss"&gt;context: &lt;/span&gt;&lt;span class="kp"&gt;nil&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="n"&gt;context&lt;/span&gt; &lt;span class="s1"&gt;'when function is requested'&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
    &lt;span class="n"&gt;let&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:response_value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="no"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;values&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;it&lt;/span&gt; &lt;span class="s1"&gt;'returns a String'&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
      &lt;span class="n"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt; &lt;span class="n"&gt;be_a&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;String&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="n"&gt;it&lt;/span&gt; &lt;span class="s2"&gt;"returns 'Hello, World!'"&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
      &lt;span class="n"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response_value&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt; &lt;span class="n"&gt;eq&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Hello, World!'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we need to include a gem in the Gemfile file of this function. &lt;/p&gt;

&lt;p&gt;Since we are using &lt;em&gt;json&lt;/em&gt; gem within the &lt;em&gt;hello&lt;/em&gt; function, we need to include it in Gemfile.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# hello-world/functions/hello/Gemfile&lt;/span&gt;
&lt;span class="n"&gt;source&lt;/span&gt; &lt;span class="s1"&gt;'https://rubygems.org'&lt;/span&gt;

&lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s1"&gt;'json'&lt;/span&gt;

&lt;span class="n"&gt;group&lt;/span&gt; &lt;span class="ss"&gt;:test&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s1"&gt;'rspec'&lt;/span&gt;
  &lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s1"&gt;'faastruby-rpc'&lt;/span&gt;
  &lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s1"&gt;'faastruby'&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Don't forget to run &lt;em&gt;bundle install&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/functions/hello/&amp;gt; bundle &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Are our unit tests passing?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;faastruby/hello-world/functions/hello/&amp;gt; rspec &lt;span class="nt"&gt;-fd&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;handler
  when &lt;span class="k"&gt;function &lt;/span&gt;is requested
    returns &lt;span class="s1"&gt;'Hello, World!'&lt;/span&gt;
    returns a String

Finished &lt;span class="k"&gt;in &lt;/span&gt;3.89 seconds &lt;span class="o"&gt;(&lt;/span&gt;files took 0.6736 seconds to load&lt;span class="o"&gt;)&lt;/span&gt;
2 examples, 0 failures
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Starting the local server again.
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Remember&lt;/strong&gt;: to upload the local server, the &lt;em&gt;faastruby local&lt;/em&gt; command, must be used in the main project folder.&lt;/p&gt;

&lt;p&gt;So, go to the root folder of the &lt;em&gt;hello-world&lt;/em&gt; project, and start the server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/&amp;gt; faastruby &lt;span class="nb"&gt;local&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's see how our &lt;em&gt;hello&lt;/em&gt; function works.&lt;/p&gt;

&lt;p&gt;Visit in your browser: &lt;a href=""&gt;http://localhost:3000/hello&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will see the following result in your browser.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello, World!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Your first deploy
&lt;/h2&gt;

&lt;p&gt;When we deploy the project to the faastRuby platform, the functions and static files go to the Workspace.&lt;/p&gt;

&lt;p&gt;In order to deploy the project, the &lt;em&gt;faastruby deploy&lt;/em&gt; command must be used in the main project folder.&lt;/p&gt;

&lt;p&gt;So make sure you are in the &lt;em&gt;hello-world&lt;/em&gt; folder and run the deploy command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/&amp;gt; faastruby deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌ Deploying project &lt;span class="s1"&gt;'hello-world'&lt;/span&gt; to workspace &lt;span class="s1"&gt;'hello-world-stage-8f6999'&lt;/span&gt;
├── &lt;span class="o"&gt;[&lt;/span&gt;✔] Connecting to workspace &lt;span class="s1"&gt;'hello-world-stage-999999'&lt;/span&gt;
├── &lt;span class="o"&gt;[&lt;/span&gt;✔] Uploading static assets &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="s1"&gt;'public'&lt;/span&gt;
├── &lt;span class="o"&gt;[&lt;/span&gt;✔] Deploying &lt;span class="k"&gt;function &lt;/span&gt;from &lt;span class="s1"&gt;'functions/hello'&lt;/span&gt;
├── &lt;span class="o"&gt;[&lt;/span&gt;✔] Deploying &lt;span class="k"&gt;function &lt;/span&gt;from &lt;span class="s1"&gt;'functions/catch-all'&lt;/span&gt;
└── &lt;span class="o"&gt;[&lt;/span&gt;✔] Deploying &lt;span class="k"&gt;function &lt;/span&gt;from &lt;span class="s1"&gt;'functions/root'&lt;/span&gt;
&lt;span class="k"&gt;*&lt;/span&gt; Project URL: https://hello-world-stage-999999.tor1.faast.cloud
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, your function is available in the cloud! Your URL will look like the following URL.&lt;/p&gt;

&lt;p&gt;Visit in your browser: &lt;a href=""&gt;https://hello-world-stage-999999.tor1.faast.cloud/hello&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You'll see the output below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello, World!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;We learned how to build a faastRuby project from scratch and send it to the cloud.&lt;/li&gt;
&lt;li&gt;We learned how to create, test and execute a Ruby function locally using faastRuby local server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope you enjoyed the article!&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>crystal</category>
      <category>faastruby</category>
      <category>serverless</category>
    </item>
    <item>
      <title>The New Hello World for faastRuby - The Serverless Platform for Ruby &amp; Crystal - Part 1.</title>
      <dc:creator>Sergio Lima</dc:creator>
      <pubDate>Sat, 13 Apr 2019 20:22:44 +0000</pubDate>
      <link>https://dev.to/sergiosouzalima/the-new-hello-world-for-faastruby-the-serverless-platform-for-ruby-crystal-part-1-2o95</link>
      <guid>https://dev.to/sergiosouzalima/the-new-hello-world-for-faastruby-the-serverless-platform-for-ruby-crystal-part-1-2o95</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ffaastruby.io%2Fwp-content%2Fuploads%2F2019%2F03%2Flogo-negative-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ffaastruby.io%2Fwp-content%2Fuploads%2F2019%2F03%2Flogo-negative-1.png" title="faastRuby logo" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hi folks! I want to share with you one of the most emerging technologies for Cloud Computing. I'm talking about "Functions as a Service" or FaaS. In this article I want you to explore with me an introductory solution. We will build a serverless application, step by step, using the &lt;a href="https://www.faastruby.io" rel="noopener noreferrer"&gt;faastRuby&lt;/a&gt; platform, and we will make the solution available in the cloud.&lt;/p&gt;

&lt;p&gt;If you are not familiar with these terms, do not worry. I've described more about &lt;a href="https://www.faastruby.io" rel="noopener noreferrer"&gt;faastRuby&lt;/a&gt;, FaaS and Serverless in this article in &lt;a href="https://onebitcode.com/faastruby-serverless-ruby/" rel="noopener noreferrer"&gt;Portuguese&lt;/a&gt; and here in &lt;a href="https://faastruby.io/blog/building-a-simple-landing-page-with-faastruby-functions/" rel="noopener noreferrer"&gt;English&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;faastRuby is an incredible platform and allows us to work easily with serverless functions. The platform is intuitive and very similar to Heroku, where the server infrastructure is totally abstracted.&lt;/p&gt;

&lt;p&gt;Click here &lt;a href="https://www.faastruby.io" rel="noopener noreferrer"&gt;https://www.faastruby.io&lt;/a&gt; to know more about faastRuby.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;The faastRuby platform was updated and there were improvements after version 0.5, so I decided to rewrite the Hello World tutorial. &lt;/p&gt;

&lt;h3&gt;
  
  
  Understanding the Platform
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;faastRuby&lt;/strong&gt; is a Serverless Software Development Platform for Ruby and Crystal, made of two main components.&lt;/p&gt;

&lt;h4&gt;
  
  
  Main Components
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;faastRuby Cloud&lt;/strong&gt; - where you deploy your applications and functions to.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;faastRuby Local&lt;/strong&gt; - an SDK that allows you to develop and test rich web applications and APIs in your machine and deploy your app as a set of distributed functions to the platform. Basically all you have to do is write code. No Ops required.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Basic Concepts: &lt;strong&gt;Account, Project, Function &amp;amp; Workspace&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Account&lt;/strong&gt; - To get started with the faastRuby Cloud Platform, you'll have to create an account, which you'll use to login on the Platform. A faastRuby account belongs to a person or a company.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Function&lt;/strong&gt; - faastRuby apps are built with pure Ruby or Crystal functions. Functions are the unit of deployment of faastRuby apps. Each function is its own thing - they are independent from each other.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Project&lt;/strong&gt; - Project is where your application stays. Your project will have a main folder, subfolders, static files and functions.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Workspace&lt;/strong&gt; - Workspaces are isolated environments where you deploy your functions to. They are represented by a URL like
&lt;a href=""&gt;https://projectName-environment-abs123.tor1.faast.cloud&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Breaking Down a Workspace URL
&lt;/h4&gt;

&lt;p&gt;Example &lt;a href=""&gt;https://projectName-environment-abs123.tor1.faast.cloud&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;projectName&lt;/strong&gt;: Your faastRuby project's name.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;environment&lt;/strong&gt;: Stage is the default environment. You can choose another one like prod, dev, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;abs123&lt;/strong&gt;: This's the project identifier, used to ensure your workspaces will have unique names. It shouldn't be changed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What are we going to create?
&lt;/h2&gt;

&lt;p&gt;Using the faastRuby resources, we're going to create two Ruby functions locally, test them, and deployed them to the cloud.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tools
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ruby 2.6.0&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;gem faastruby&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step by Step Function Creation
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;

&lt;p&gt;Create your own folder for faastRuby projects and enter into it. This is not mandatory. I prefer to use this kind of folder organization, this way, all projects made in faastRuby stay inside this folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;faastruby
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;faastruby
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Perform this step only if you use the Ruby version manager, &lt;a href="https://rvm.io" rel="noopener noreferrer"&gt;RVM&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt; rvm use ruby-2.6.0@faastruby &lt;span class="nt"&gt;--ruby-version&lt;/span&gt; &lt;span class="nt"&gt;--create&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Install the gem
&lt;/h4&gt;

&lt;p&gt;If you do not have the gem installed, perform:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt; gem &lt;span class="nb"&gt;install &lt;/span&gt;faastruby
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you already have faastruby gem installed, just upgrade it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt; faastruby update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To know if it worked, let's see the gem version. For me this is the current version: 0.5.23. Note that your version may be newer, as the platform is constantly being updated.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt; faastruby &lt;span class="nt"&gt;-v&lt;/span&gt;
0.5.23
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Signing up on faastRuby Platform
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt; faastruby signup

Welcome to FaaStRuby! Please enter your email address:
Email: &lt;span class="o"&gt;&amp;lt;&amp;lt;&amp;lt;&lt;/span&gt; you@your-email.com &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After entering your email, you can enter with your password.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Now &lt;span class="nb"&gt;type &lt;/span&gt;&lt;span class="k"&gt;in &lt;/span&gt;a password. 
It must contain 8 to 50 characters and have at least 
one uppercase letter, one lowercase letter, 
one number and one special character @ &lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt; % &lt;span class="k"&gt;*&lt;/span&gt; ? &amp;amp;
&lt;span class="k"&gt;************&lt;/span&gt;
✔ Creating your account...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll then receive an email with a token for verification. Copy and paste the token into the field indicated below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;You should have received an email with a confirmation token.
If you didn&lt;span class="s1"&gt;'t receive an email:
- Make sure you sign up with the correct email address
- The system won'&lt;/span&gt;t send an email &lt;span class="k"&gt;if &lt;/span&gt;you account status is already &lt;span class="s1"&gt;'confirmed'&lt;/span&gt;
Confirmation Token: &lt;span class="o"&gt;&amp;lt;&amp;lt;&amp;lt;&lt;/span&gt; your token here &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, you'll be registered and logged into the platform.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;✔ Confirming your account...
Login successful!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you need to login, use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt; faastruby login       
Email: you@your-email.com
Password: &lt;span class="k"&gt;***********&lt;/span&gt;
Login successful.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And when you need to logout, you can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt; faastruby &lt;span class="nb"&gt;logout&lt;/span&gt; &lt;span class="c"&gt;## use --all to logout from all machines&lt;/span&gt;
Logout successful.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  This article continues on &lt;a href="https://dev.to/sergiosouzalima/the-new-hello-world-for-faastruby-the-serverless-platform-for-ruby-crystal-part-2-29pk"&gt;Part 2&lt;/a&gt; where we'll build up a faastRuby project and deploy it to the cloud.
&lt;/h4&gt;

</description>
      <category>ruby</category>
      <category>crystal</category>
      <category>faastruby</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Reapresentando o Hello World para faastRuby - A Plataforma Serverless para Ruby e Crystal - Parte II.</title>
      <dc:creator>Sergio Lima</dc:creator>
      <pubDate>Sat, 30 Mar 2019 18:39:43 +0000</pubDate>
      <link>https://dev.to/sergiosouzalima/reapresentando-o-hello-world-para-faastruby-a-plataforma-serverless-para-ruby-e-crystal-parte-ii-31c5</link>
      <guid>https://dev.to/sergiosouzalima/reapresentando-o-hello-world-para-faastruby-a-plataforma-serverless-para-ruby-e-crystal-parte-ii-31c5</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ffaastruby.io%2Fwp-content%2Fuploads%2F2019%2F03%2Flogo-negative-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ffaastruby.io%2Fwp-content%2Fuploads%2F2019%2F03%2Flogo-negative-1.png" title="faastRuby logo" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Olá amigos developers! Esta é a segunda parte do artigo. Se você quer saber conceitos básicos sobre faastRuby ou ainda não se cadastrou na plataforma comece por aqui &lt;a href="https://dev.to/sergiosouzalima/reapresentando-o-hello-world-para-faastruby-a-plataforma-serverless-para-ruby-e-crystal-parte-i-ac0"&gt;Parte I&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;O que vamos criar?&lt;br&gt;
Usando os comandos e a plataforma serverless &lt;a href="https://www.faastruby.io" rel="noopener noreferrer"&gt;faastRuby&lt;/a&gt;, vamos criar uma function em Ruby e disponibilizá-la rapidamente na internet.&lt;/p&gt;
&lt;h2&gt;
  
  
  Passo a Passo da Criação do Projeto
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Login
&lt;/h3&gt;

&lt;p&gt;Entre na pasta que criamos anteriormente.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;faastruby
&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Faça o login com a conta criada na &lt;a href="https://dev.to/sergiosouzalima/reapresentando-o-hello-world-para-faastruby-a-plataforma-serverless-para-ruby-e-crystal-parte-i-ac0"&gt;Parte I&lt;/a&gt; deste artigo.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt;faastruby login       
Email: you@your-email.com
Password: &lt;span class="k"&gt;********&lt;/span&gt;
Login successful.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Criando o Projeto Hello World
&lt;/h3&gt;

&lt;p&gt;Agora vamos criar o projeto Hello World propriamente dito.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt;faastruby new-project hello-world &lt;span class="nt"&gt;--api&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;O comando &lt;em&gt;faastruby new-project&lt;/em&gt; irá criar a pasta &lt;em&gt;hello-world&lt;/em&gt; com as subpastas, arquivos estáticos e functions iniciais. Você verá a mensagem abaixo&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;+ d ./hello-world
+ f ./hello-world/project.yml
+ f ./hello-world/secrets.yml
+ d ./hello-world/functions/root
+ f ./hello-world/functions/root/handler.rb
+ f ./hello-world/functions/root/faastruby.yml
+ d ./hello-world/functions/catch-all
+ f ./hello-world/functions/catch-all/handler.rb
+ f ./hello-world/functions/catch-all/faastruby.yml
+ d ./hello-world/public
+ f ./hello-world/public/faastruby.yml
+ f ./hello-world/.gitignore
Initialized empty Git repository &lt;span class="k"&gt;in&lt;/span&gt; /Users/you/workspace/faastruby/hello-world/.git/
Project &lt;span class="s1"&gt;'hello-world'&lt;/span&gt; initialized.
Now run:
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;hello-world
&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby &lt;span class="nb"&gt;local

&lt;/span&gt;Then visit http://localhost:3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Entre na pasta &lt;em&gt;hello-world&lt;/em&gt; que acabamos de criar.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt; &lt;span class="nb"&gt;cd &lt;/span&gt;hello-world
&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Significado de Pastas e Arquivos
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;├── functions &amp;lt;&lt;span class="nt"&gt;----------------&lt;/span&gt; Todas functions ficam dentro desta pasta
│   ├── catch-all &amp;lt;&lt;span class="nt"&gt;------------&lt;/span&gt; Se uma &lt;span class="k"&gt;function &lt;/span&gt;não é encontrada, esta &lt;span class="k"&gt;function &lt;/span&gt;é executada.
│   │   ├── faastruby.yml
│   │   └── handler.rb
│   └── root &amp;lt;&lt;span class="nt"&gt;-----------------&lt;/span&gt; Requisições em &lt;span class="s2"&gt;"root path"&lt;/span&gt; &lt;span class="s1"&gt;'/'&lt;/span&gt; caem aqui.
│       ├── faastruby.yml &amp;lt;&lt;span class="nt"&gt;----&lt;/span&gt; Configuração de arquivos estáticos.
│       └── handler.rb
├── project.yml &amp;lt;&lt;span class="nt"&gt;--------------&lt;/span&gt; Arquivo de configuração &lt;span class="k"&gt;do &lt;/span&gt;projeto.
├── public &amp;lt;&lt;span class="nt"&gt;-------------------&lt;/span&gt; Aqui dentro ficam arquivos estáticos.
│   └── faastruby.yml
└── secrets.yml &amp;lt;&lt;span class="nt"&gt;--------------&lt;/span&gt; Seus secrets ficam aqui.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Subindo o Servidor Local&lt;br&gt;
Agora vamos subir o servidor local e verificar se nosso projeto está funcionando.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/&amp;gt; faastruby &lt;span class="nb"&gt;local&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Você verá a mensagem&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Puma starting &lt;span class="k"&gt;in &lt;/span&gt;single mode...
&lt;span class="k"&gt;*&lt;/span&gt; Version 3.12.1 &lt;span class="o"&gt;(&lt;/span&gt;ruby 2.6.0-p0&lt;span class="o"&gt;)&lt;/span&gt;, codename: Llamas &lt;span class="k"&gt;in &lt;/span&gt;Pajamas
&lt;span class="k"&gt;*&lt;/span&gt; Min threads: 0, max threads: 32
&lt;span class="k"&gt;*&lt;/span&gt; Environment: production
&lt;span class="k"&gt;*&lt;/span&gt; Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
2019-03-23 16:21:23 &lt;span class="nt"&gt;-0300&lt;/span&gt; | Detecting existing functions.
&lt;span class="nt"&gt;---&lt;/span&gt;
2019-03-23 16:21:23 &lt;span class="nt"&gt;-0300&lt;/span&gt; | Ruby functions: &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"root"&lt;/span&gt;, &lt;span class="s2"&gt;"catch-all"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="nt"&gt;---&lt;/span&gt;
2019-03-23 16:21:23 &lt;span class="nt"&gt;-0300&lt;/span&gt; | Crystal functions: &lt;span class="o"&gt;[]&lt;/span&gt;
&lt;span class="nt"&gt;---&lt;/span&gt;
2019-03-23 16:21:23 &lt;span class="nt"&gt;-0300&lt;/span&gt; | Listening &lt;span class="k"&gt;for &lt;/span&gt;changes.
&lt;span class="nt"&gt;---&lt;/span&gt;
2019-03-23 16:21:23 &lt;span class="nt"&gt;-0300&lt;/span&gt; | faastRuby Local is ready at http://localhost:3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Em seguida visite o endereço: &lt;a href=""&gt;http://localhost:3000&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Se tudo está funcionando bem até aqui, você verá o resultado da function &lt;em&gt;root&lt;/em&gt; em seu browser.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Welcome to FaaStRuby Local! Edit the function 'root' to customize this response.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Criando Sua Primeira Function
&lt;/h3&gt;

&lt;p&gt;Sua primeira function será chamada &lt;em&gt;hello&lt;/em&gt; e ela responderá no formato json com a mensagem "Hello, World!".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Importante&lt;/strong&gt;: para criar functions, você deve estar dentro da pasta &lt;em&gt;functions&lt;/em&gt; de seu projeto.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/&amp;gt; &lt;span class="nb"&gt;cd &lt;/span&gt;functions
&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/functions/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use o comando &lt;em&gt;faastruby new hello&lt;/em&gt; para criar a function &lt;em&gt;hello&lt;/em&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/functions&amp;gt; faastruby new hello
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;+ d hello
+ d hello/spec
+ f hello/spec/spec_helper.rb
+ f hello/spec/handler_spec.rb
+ f hello/README.md
+ f hello/Gemfile
+ f hello/handler.rb
+ f hello/faastruby.yml
✔ Installing gems...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;O comando &lt;em&gt;faastruby new&lt;/em&gt; criou pastas e arquivos iniciais específicas para sua function &lt;em&gt;hello&lt;/em&gt;.&lt;br&gt;
Vamos entrar dentro da pasta &lt;em&gt;hello&lt;/em&gt; para implementarmos nossa solução em Ruby.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/functions/&amp;gt; &lt;span class="nb"&gt;cd &lt;/span&gt;hello
&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/functions/hello/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Faça sua function &lt;em&gt;hello&lt;/em&gt; ficar assim:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# hello-world/functions/hello/handler.rb&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'json'&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;handler&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;
  &lt;span class="n"&gt;render&lt;/span&gt; &lt;span class="ss"&gt;json: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s1"&gt;'message'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Hello, World!'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Temos que ajustar o teste unitário:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# hello-world/functions/hello/spec/handler_spec.rb&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'spec_helper'&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'handler'&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'json'&lt;/span&gt;

&lt;span class="n"&gt;describe&lt;/span&gt; &lt;span class="s1"&gt;'#handler'&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="n"&gt;let&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;body&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;let&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="no"&gt;Event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="ss"&gt;body: &lt;/span&gt;&lt;span class="kp"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;query_params: &lt;/span&gt;&lt;span class="p"&gt;{},&lt;/span&gt;
      &lt;span class="ss"&gt;headers: &lt;/span&gt;&lt;span class="p"&gt;{},&lt;/span&gt; &lt;span class="ss"&gt;context: &lt;/span&gt;&lt;span class="kp"&gt;nil&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="n"&gt;context&lt;/span&gt; &lt;span class="s1"&gt;'when function is requested'&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
    &lt;span class="n"&gt;let&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:response_value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="no"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;values&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;it&lt;/span&gt; &lt;span class="s1"&gt;'returns a String'&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
      &lt;span class="n"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt; &lt;span class="n"&gt;be_a&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;String&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="n"&gt;it&lt;/span&gt; &lt;span class="s2"&gt;"returns 'Hello, World!'"&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
      &lt;span class="n"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response_value&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt; &lt;span class="n"&gt;eq&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Hello, World!'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Agora precisamos incluir uma gem no arquivo Gemfile desta function. Estamos usando a gem &lt;em&gt;json&lt;/em&gt; dentro da function &lt;em&gt;hello&lt;/em&gt;, portanto precisamos inclui-la no Gemfile.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# hello-world/functions/hello/Gemfile&lt;/span&gt;
&lt;span class="n"&gt;source&lt;/span&gt; &lt;span class="s1"&gt;'https://rubygems.org'&lt;/span&gt;

&lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s1"&gt;'json'&lt;/span&gt;

&lt;span class="n"&gt;group&lt;/span&gt; &lt;span class="ss"&gt;:test&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s1"&gt;'rspec'&lt;/span&gt;
  &lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s1"&gt;'faastruby-rpc'&lt;/span&gt;
  &lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s1"&gt;'faastruby'&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Não esqueça do &lt;em&gt;bundle install&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/functions/hello/&amp;gt; bundle &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nossos testes estão passando?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;faastruby/hello-world/functions/hello/&amp;gt; rspec &lt;span class="nt"&gt;-fd&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;handler
  when &lt;span class="k"&gt;function &lt;/span&gt;is requested
    returns &lt;span class="s1"&gt;'Hello, World!'&lt;/span&gt;
    returns a String

Finished &lt;span class="k"&gt;in &lt;/span&gt;3.89 seconds &lt;span class="o"&gt;(&lt;/span&gt;files took 0.6736 seconds to load&lt;span class="o"&gt;)&lt;/span&gt;
2 examples, 0 failures
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Subindo o Servidor Local, Novamente&lt;/p&gt;

&lt;p&gt;Lembre-se sempre que para subir o servidor local o comando &lt;em&gt;faastruby local&lt;/em&gt; deverá ser usado na pasta principal do projeto.&lt;/p&gt;

&lt;p&gt;Portanto vá para a pasta raiz do projeto, &lt;em&gt;hello-world&lt;/em&gt; e suba o servidor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/&amp;gt; faastruby &lt;span class="nb"&gt;local&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Vamos ver o funcionamento da nossa function &lt;em&gt;hello&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Visite o endereço: &lt;a href=""&gt;http://localhost:3000/hello&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Você verá o resultado da function &lt;em&gt;hello&lt;/em&gt; em seu browser.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello, World!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  O Primeiro Deploy
&lt;/h3&gt;

&lt;p&gt;Quando executamos o deploy do projeto para a plataforma faastRuby, as functions e arquivos estáticos vão para o Workspace.&lt;/p&gt;

&lt;p&gt;Para fazer o deploy do projeto o comando &lt;em&gt;faastruby deploy&lt;/em&gt; deverá ser usado na pasta principal do projeto.&lt;/p&gt;

&lt;p&gt;Portanto certifique-se que você está na pasta &lt;em&gt;hello-world&lt;/em&gt; e execute o deploy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/hello-world/&amp;gt; faastruby deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌ Deploying project &lt;span class="s1"&gt;'hello-world'&lt;/span&gt; to workspace &lt;span class="s1"&gt;'hello-world-stage-8f6999'&lt;/span&gt;
├── &lt;span class="o"&gt;[&lt;/span&gt;✔] Connecting to workspace &lt;span class="s1"&gt;'hello-world-stage-999999'&lt;/span&gt;
├── &lt;span class="o"&gt;[&lt;/span&gt;✔] Uploading static assets &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="s1"&gt;'public'&lt;/span&gt;
├── &lt;span class="o"&gt;[&lt;/span&gt;✔] Deploying &lt;span class="k"&gt;function &lt;/span&gt;from &lt;span class="s1"&gt;'functions/hello'&lt;/span&gt;
├── &lt;span class="o"&gt;[&lt;/span&gt;✔] Deploying &lt;span class="k"&gt;function &lt;/span&gt;from &lt;span class="s1"&gt;'functions/catch-all'&lt;/span&gt;
└── &lt;span class="o"&gt;[&lt;/span&gt;✔] Deploying &lt;span class="k"&gt;function &lt;/span&gt;from &lt;span class="s1"&gt;'functions/root'&lt;/span&gt;
&lt;span class="k"&gt;*&lt;/span&gt; Project URL: https://hello-world-stage-999999.tor1.faast.cloud
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finalmente, sua function está disponível na nuvem! A sua URL será parecida com a URL a seguir.&lt;/p&gt;

&lt;p&gt;Visite o endereço no seu browser: &lt;a href=""&gt;https://hello-world-stage-999999.tor1.faast.cloud/hello&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Você verá o resultado da function &lt;em&gt;hello&lt;/em&gt; em seu browser.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello, World!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusão
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Neste artigo aprendemos como construir um projeto em faastRuby do zero e enviar para a nuvem.&lt;/li&gt;
&lt;li&gt;Aprendemos como criar uma function própria, criar testes unitários e executar a function com o servidor local.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Espero que tenham gostado do artigo!&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>crystal</category>
      <category>faastruby</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Reapresentando o Hello World para faastRuby - A Plataforma Serverless para Ruby e Crystal - Parte I.</title>
      <dc:creator>Sergio Lima</dc:creator>
      <pubDate>Sat, 30 Mar 2019 18:37:48 +0000</pubDate>
      <link>https://dev.to/sergiosouzalima/reapresentando-o-hello-world-para-faastruby-a-plataforma-serverless-para-ruby-e-crystal-parte-i-ac0</link>
      <guid>https://dev.to/sergiosouzalima/reapresentando-o-hello-world-para-faastruby-a-plataforma-serverless-para-ruby-e-crystal-parte-i-ac0</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ffaastruby.io%2Fwp-content%2Fuploads%2F2019%2F03%2Flogo-negative-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ffaastruby.io%2Fwp-content%2Fuploads%2F2019%2F03%2Flogo-negative-1.png" title="faastRuby logo" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Olá amigos developers! Quero compartilhar com vocês uma das tecnologias mais emergentes para computação em nuvem. Estou falando de "Funções como Serviço" ou FaaS. Neste artigo, quero que vocês explorem comigo uma solução introdutória. Vamos construir uma função Serverless, passo a passo, usando a plataforma &lt;a href="https://www.faastruby.io" rel="noopener noreferrer"&gt;faastRuby&lt;/a&gt;, e disponibilizaremos a solução na nuvem.&lt;/p&gt;

&lt;p&gt;Se você não estiver familiarizado com esses termos, não se preocupe, eu descrevi mais sobre &lt;a href="https://www.faastruby.io" rel="noopener noreferrer"&gt;faastRuby&lt;/a&gt;, FaaS e Serverless neste artigo em &lt;a href="https://onebitcode.com/faastruby-serverless-ruby/" rel="noopener noreferrer"&gt;português&lt;/a&gt; e aqui em &lt;a href="https://faastruby.io/blog/building-a-simple-landing-page-with-faastruby-functions/" rel="noopener noreferrer"&gt;inglês&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A plataforma &lt;a href="https://www.faastruby.io" rel="noopener noreferrer"&gt;faastRuby&lt;/a&gt; é incrível e nos permite trabalhar de maneira fácil com funções sem servidor. A plataforma é intuitiva e muito parecida com o Heroku, onde toda a infraestrutura do servidor é abstraída.&lt;/p&gt;

&lt;p&gt;Para saber mais sobre esta plataforma, visite o website da empresa criadora do faastRuby: &lt;a href="https://www.faastruby.io" rel="noopener noreferrer"&gt;https://www.faastruby.io&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Vamos lá!&lt;/p&gt;

&lt;h2&gt;
  
  
  Introdução
&lt;/h2&gt;

&lt;p&gt;A plataforma faastRuby foi atualizada e houve melhorias após a versão 0.5, portanto precisei reescrever o Hello World. Este artigo é uma atualização do artigo anterior. É um tutorial para construir um projeto básico usando os novos recursos.&lt;/p&gt;

&lt;h3&gt;
  
  
  Entendendo a Plataforma
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;faastRuby&lt;/strong&gt; é uma plataforma de desenvolvimento de software serverless para Ruby e Crystal e é composta de dois componentes principais.&lt;/p&gt;

&lt;h4&gt;
  
  
  Componentes Principais
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;faastRuby Cloud&lt;/strong&gt; - é a plataforma para onde vão os deploys e onde ficam seus aplicativos e funções.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;faastRuby Local&lt;/strong&gt; - um SDK (software development kit) que permite desenvolver e testar aplicativos web e APIs na máquina local e implantar um aplicativo como um conjunto de funções distribuídas na plataforma. Operações de deploy ou de infraestrutura não são requeridos.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Conceitos básicos: &lt;strong&gt;Account, Project, Function e Workspace&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Account&lt;/strong&gt; - É necessário ter uma conta para usar a plataforma faastRuby. Cada conta pertence a uma pessoa ou uma empresa, que deve se identificar com seu email, senha e um token, que será gerado.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Function&lt;/strong&gt; - É onde fica a solução em forma de código fonte. As funções são independentes umas das outras. Para Ruby e Crystal usamos métodos como funções.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Project&lt;/strong&gt; - Projeto é onde fica a aplicação. O projeto terá uma pasta principal, terá subpastas, arquivos estáticos e funções.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Workspace&lt;/strong&gt; - São espaços ou ambientes isolados na nuvem. Os deploys tem como destino as Workspaces e é lá onde ficam as functions. Workspaces são representados por uma URL do tipo: 
&lt;a href=""&gt;https://projectName-environment-abs123.tor1.faast.cloud&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Detalhando uma URL de Workspace
&lt;/h4&gt;

&lt;p&gt;Exemplo &lt;a href=""&gt;https://projectName-environment-abs123.tor1.faast.cloud&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;projectName&lt;/strong&gt;: Nome dado ao projeto.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;environment&lt;/strong&gt;: Stage é o ambiente default. Você pode escolher outro como prod, dev, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;abs123&lt;/strong&gt;: Identificador único e gerado automaticamente para cada projeto. Não deve ser mudado.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  O que vamos criar?
&lt;/h2&gt;

&lt;p&gt;Usando a plataforma faastRuby, vamos criar duas funções em Ruby e disponibilizá-las rapidamente na internet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ferramentas que vamos precisar
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ruby 2.6.0&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;gem faastruby&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Passo a Passo da Criação do Projeto
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Instalação
&lt;/h3&gt;

&lt;p&gt;Crie uma pasta própria para projetos faastRuby e entre dentro dela. Isto não é obrigatório. Eu prefiro usar esta organização de pastas, assim todos projetos feitos em faastRuby ficam dentro desta pasta.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;faastruby
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;faastruby
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Execute este passo se você usa o gerenciador de versões Ruby, &lt;a href="https://rvm.io" rel="noopener noreferrer"&gt;RVM&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt; rvm use ruby-2.6.0@faastruby &lt;span class="nt"&gt;--ruby-version&lt;/span&gt; &lt;span class="nt"&gt;--create&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Instale a gem
&lt;/h4&gt;

&lt;p&gt;Se você nao tem a gem instalada, faça:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt; gem &lt;span class="nb"&gt;install &lt;/span&gt;faastruby
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Se você já tem a gem faastruby instalada, apenas atualize:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt; faastruby update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Para saber se a instalação funcionou, consulte a versão da gem faastruby. Sua versão pode ser mais nova, já que a gem está sendo atualizada com frequência.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt; faastruby &lt;span class="nt"&gt;-v&lt;/span&gt;
0.5.21
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Registrando-se na Plataforma
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt; faastruby signup

Welcome to FaaStRuby! Please enter your email address:
Email: you@your-email.com

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Depois de entrar com seu email, será solicitada a senha.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Now &lt;span class="nb"&gt;type &lt;/span&gt;&lt;span class="k"&gt;in &lt;/span&gt;a password. 
It must contain 8 to 50 characters and have at least 
one uppercase letter, one lowercase letter, 
one number and one special character @ &lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt; % &lt;span class="k"&gt;*&lt;/span&gt; ? &amp;amp;
&lt;span class="k"&gt;************&lt;/span&gt;
✔ Creating your account...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Em seguida, você receberá um email com um token para confirmação. Copie e cole o token no campo indicado abaixo.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;You should have received an email with a confirmation token.
If you didn&lt;span class="s1"&gt;'t receive an email:
- Make sure you sign up with the correct email address
- The system won'&lt;/span&gt;t send an email &lt;span class="k"&gt;if &lt;/span&gt;you account status is already &lt;span class="s1"&gt;'confirmed'&lt;/span&gt;
Confirmation Token: &lt;span class="o"&gt;&amp;lt;&amp;lt;&amp;lt;&lt;/span&gt; seu token aqui &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Em sequência você estará registrado e logado na plataforma.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;✔ Confirming your account...
Login successful!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Da próxima vez que você precisar se logar use o comando:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt; faastruby login       
Email: you@your-email.com
Password: &lt;span class="k"&gt;***********&lt;/span&gt;
Login successful.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;E quando você precisar se deslogar pode usar:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;faastruby/&amp;gt; faastruby &lt;span class="nb"&gt;logout&lt;/span&gt; &lt;span class="c"&gt;## use --all para deslogar de todas máquinas&lt;/span&gt;
Logout successful.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Este artigo continua na &lt;a href="https://dev.to/sergiosouzalima/reapresentando-o-hello-world-para-faastruby-a-plataforma-serverless-para-ruby-e-crystal-parte-ii-31c5"&gt;Parte II&lt;/a&gt; onde começaremos com a criação do projeto.
&lt;/h4&gt;

</description>
      <category>ruby</category>
      <category>crystal</category>
      <category>faastruby</category>
      <category>serverless</category>
    </item>
  </channel>
</rss>
