Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the project to serverless #319

Closed
malaquiasdev opened this issue Feb 25, 2021 · 0 comments
Closed

Update the project to serverless #319

malaquiasdev opened this issue Feb 25, 2021 · 0 comments

Comments

@malaquiasdev
Copy link
Collaborator

malaquiasdev commented Feb 25, 2021

The focus of this update the project to works with serverless.

We will use the service bellow in AWS:

CloudFront
AWS S3 - Para salvar as flags
AWS XRAY
AWS Cloud Watch
AWS API Gateway
AWS Lambda
AWS Dynamodb

Intregation Diagram:

dialetus-service

Folders:

root 
 └ node_modules (auto-generated)    → NPM dependencies
 └ test                             → Pasta de teste que centraliza os testes unitários ou funcionais
 └ README.md                        → Arquivo que introduz e explica o projeto
 └ serverless.yml                   → Arquivo principal do Serverless Framework responsavel por configurar os ambientes e importar os arquivos functions.yml
 └ serverless.env.yml               → Arquivo que centraliza as variaveis de ambiente por stage
 └ src                              → Pasta principal com código de todo o projeto
   └ components                     → Comunicação do projeto com o mundo exterior (ex: banco de dados, fila, storage, arquivos locais "/tmp/")
     └ dynamodb                     
     └ s3     
     └ file   
     └ http 
     └ logger  
     └ xray       
   └ lib                            → Funções puras sem conexão externas que servem como ferramenta de "utilidades", por exemplo: String format, Date format, Regex processing, response wrapper, error handler e etc
     └ http                        
        └ handler-success            → Funções que moldam a response HTTP, por exemplo: handler de error para retornar uma status code HTTP especifico, controle de cache, cors, handler de sucesso para padronizar o objeto
        └ handler-error            → Funções que moldam a response HTTP, por exemplo: handler de error para retornar uma status code HTTP especifico, controle de cache, cors, handler de sucesso para padronizar o objeto
     └ string-utils                 
     └ date-utils                 
    └ functions                     →
      └ send-message                → Pasta da função/rota
        └ config.js                 → Módulo que importa as variaveis de ambiente para o scopo da função
        └ function.yml              → Configuração de recursos de função, como: nome da função, trigger da função, por exemplo: HTTP, schedule. sqs, tamanho da memória, cors
        └ handler.js                → Ponto de entrada de função, semelhante a um controller
        └ use-case                  → Modulo responsavel pelas regras de negocio
        └ serializer                → Serializa os dados internos para o modelo de resposta do mundo externo (basicamente cria o body da response)

List of initial libs:

dependencies:

devDependencies:

@malaquiasdev malaquiasdev self-assigned this Feb 25, 2021
malaquiasdev added a commit that referenced this issue Feb 25, 2021
malaquiasdev added a commit that referenced this issue Feb 25, 2021
…ess yml and the scripts in the package.json
malaquiasdev added a commit that referenced this issue Feb 26, 2021
malaquiasdev added a commit that referenced this issue Feb 26, 2021
malaquiasdev added a commit that referenced this issue Feb 26, 2021
malaquiasdev added a commit that referenced this issue Feb 26, 2021
malaquiasdev added a commit that referenced this issue Feb 26, 2021
malaquiasdev added a commit that referenced this issue Feb 26, 2021
malaquiasdev added a commit that referenced this issue Feb 28, 2021
@mvfsillva mvfsillva pinned this issue Feb 28, 2021
malaquiasdev added a commit that referenced this issue Feb 28, 2021
malaquiasdev added a commit that referenced this issue Feb 28, 2021
malaquiasdev added a commit that referenced this issue Feb 28, 2021
malaquiasdev added a commit that referenced this issue Feb 28, 2021
…p us to controll the api gateway stage. Created a api gateway resource with some generic configurations to all endpoints
malaquiasdev added a commit that referenced this issue Mar 1, 2021
malaquiasdev added a commit that referenced this issue Mar 1, 2021
* #319 - configured the dynamodb resource to regions endpoints

* #319 - fix the deploy configuration

* #319 - created the insert partiql query

* #319 - fixed the convert records unit test

* #319 - handler the dynamodb error

* #319 - fix handleErrorResponse module unit test

* #319 - fix logger module unit test

* #319 - refactor the save query to use dynamodb client lib

* #319 - set draft as index of RegionTable

* #319 - create a folder to guard the resources files

* #319 - fix regionTable draft atribute typ to string, because a boolean can not be a index

* #319 - installed the serverless-plugin-stage-variables plugin, to help us to controll the api gateway stage. Created a api gateway resource with some generic configurations to all endpoints

* #319 - change the new region draft default value to be a string

* #319 - change the api gateway CreateNewRegionModel validator

* #319 - UF must be uppercase in region table

* #319 - create a unit test to use case

* #319 - create a unit test to validate that the code is not broken when we have a exception
malaquiasdev added a commit that referenced this issue Mar 2, 2021
malaquiasdev added a commit that referenced this issue Mar 27, 2021
* #319 - create the GET regions endpoint flow

* #319 - fix findregions query must has draft as false by default

* #319 - put a one week cache max age value in the GET regions endpoints

* #319 - created the unit test to the get all regions function
malaquiasdev added a commit that referenced this issue Mar 27, 2021
* #319 - create a new rule to not save a new region, if it exist in the table

* #319 - remove console.log
@mvfsillva mvfsillva self-assigned this Mar 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants