Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Entrega do desafio - Luiz #112

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 72 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,78 @@
# Desafio técnico para desenvolvedores
Projeto backend base com Node.js 14 + Express, configurado em contêineres do Docker com docker-compose.
Frontend desenvolvido com React.js

Construa uma nova aplicação, utilizando o framework de sua preferência (Ruby on Rails, Elixir Phoenix, Python Django ou Flask, NodeJS Sails, Java Spring, ASP.NET ou outro), a qual deverá conectar na API do GitHub e disponibilizar as seguintes funcionalidades:
Url de deploy: http://ateliware-front.s3-website-sa-east-1.amazonaws.com/

- Botão para buscar e armazenar os repositórios destaques de 5 linguagens à sua escolha;
- Listar os repositórios encontrados;
- Visualizar os detalhes de cada repositório.
## Estrutura de serviços do docker

Alguns requisitos:
- **application**: Node.js 14
- **database**: Banco de dados Mysql 5.7

- Deve ser uma aplicação totalmente nova;
- A solução deve estar em um repositório público do GitHub;
- A aplicação deve armazenar as informações encontradas;
- Utilizar PostgreSQL, MySQL ou SQL Server;
- O deploy deve ser realizado, preferencialmente, no Heroku, AWS ou no Azure;
- A aplicação precisa ter testes automatizados;
- Preferenciamente dockerizar a aplicação;
- Por favor atualizar o readme da aplicação com passo a passo com instrução para subir o ambiente.
## Configuração do ambiente de desenvolvimento

Quando terminar, faça um Pull Request neste repo e avise-nos por email.
### 1. Clonar o repositório

**IMPORTANTE:** se você não conseguir finalizar o teste, por favor nos diga o motivo e descreva quais foram as suas dificuldades. Você pode também sugerir uma outra abordagem para avaliarmos seus skills técnicos, vender seu peixe, mostrar-nos do que é capaz.
```bash
git clone [email protected]:luizgzanella/ateliware-test-app.git
```

### FRONT END

Acessar a pasta `front`

```bash
cd front
```

### 2.1. Instalar pacotes

```bash
yarn install
```

### 2.2. Iniciar serviço

```bash
yarn start
```

### Acessar a aplicação em <http://localhost:3000>

### BACK END

Acessar a pasta `backend`

```bash
cd backend
```

### 2 Configurar variáveis de ambiente

Renomeie o arquivo .env `example.env` para `.env`

### 3. Instalar pacotes

```bash
yarn install
```

```bash
docker-compose up -d
```

### 5. Migration (Opcional)

1. Rodar migrations do banco de dados (Opcional)

2.

```bash
yarn migrate
```

### 7. Acessar a aplicação em <http://localhost:6868>

## Comandos úteis

- Inicar docker: `docker-compose up`
- Parar docker: `docker-compose down`
130 changes: 130 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
8 changes: 8 additions & 0 deletions backend/.sequelizerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var path = require('path')

module.exports = {
'config': path.resolve('config', 'config.json'),
'migrations-path': path.resolve('src', 'migrations'),
'models-path': path.resolve('src', 'models',),
'seeders-path': path.resolve('src', 'seeders'),
}
6 changes: 6 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM node:14
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
CMD npm start
24 changes: 24 additions & 0 deletions backend/config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"development": {
"username": "root",
"password": "123456",
"database": "ate_db",
"host": "127.0.0.1",
"port": 3307,
"dialect": "mysql"
},
"test": {
"username": "root",
"password": null,
"database": "database_test",
"host": "127.0.0.1",
"dialect": "mysql"
},
"production": {
"username": "root",
"password": null,
"database": "database_production",
"host": "127.0.0.1",
"dialect": "mysql"
}
}
41 changes: 41 additions & 0 deletions backend/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: '3.8'
services:
mysqldb:
image: mysql:5.7
restart: unless-stopped
env_file: ./.env
environment:
- MYSQL_ROOT_PASSWORD=$MYSQLDB_ROOT_PASSWORD
- MYSQL_DATABASE=$MYSQLDB_DATABASE
ports:
- $MYSQLDB_LOCAL_PORT:$MYSQLDB_DOCKER_PORT
volumes:
- db:/var/lib/mysql
healthcheck:
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ]
timeout: 20s
retries: 10
app:
depends_on:
mysqldb:
condition: service_healthy
build: .
restart: unless-stopped
env_file: ./.env
ports:
- $NODE_LOCAL_PORT:$NODE_DOCKER_PORT
command: npm run dev
environment:
- DB_HOST=mysqldb
- DB_USER=$MYSQLDB_USER
- DB_PASSWORD=$MYSQLDB_ROOT_PASSWORD
- DB_NAME=$MYSQLDB_DATABASE
- DB_PORT=$MYSQLDB_DOCKER_PORT
stdin_open: true
tty: true
volumes:
- .:/app
- /app/node_modules
volumes:
db:
home_data:
17 changes: 17 additions & 0 deletions backend/example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=123456
DB_NAME=ate_db
DB_PORT=3306
NODE_DOCKER_PORT=8080

MYSQLDB_USER=root
MYSQLDB_ROOT_PASSWORD=123456
MYSQLDB_DATABASE=ate_db
MYSQLDB_LOCAL_PORT=3307
MYSQLDB_DOCKER_PORT=3306
NODE_LOCAL_PORT=6868
NODE_DOCKER_PORT=8080


PORT=3050
Loading