🇺🇸 English
This is the seventh project of the Back-end curriculum developed at Trybe.
In this project I developed a RESTful API for sales of a medieval items store in TypeScript, where it is possible to perform basic operations on a database: Create, Read, Update and Delete. Authentication was done with JSON Web Token.
Installing and running with Docker
To run this application you need to have Git, Docker and Docker Compose installed on your computer. Docker Compose needs to be version 1.29 or higher.
git clone [email protected]:apoishi/trybe-trybesmith.git
cd trybe-trybesmith
docker-compose up -d --build
Connect to the MySQL server running on port 3306, and enter the following credentials:
host: db
user: root
password: password
Go to the MySQL client of your preference, and run the script that is in the Trybesmith.sql file.
docker exec -it trybesmith bash
npm install
npm run dev
- I used Thunder Client as a client for HTTP requests and MySQLWorkbench as a MySQL client*
- Declare and use Typescript typings for variables and functions;
- Use Express with Typescript;
POST /login
• If the login was successful, it returns a token to the user.
POST /order
• Register a new order.
GET /order
• Return all orders.
• Validate the token.
POST /product
• Register a new product.
GET /product
• Return all products.
POST /user
• Register a new user in the database.
- Node
- Express
- Sequelize
- Json Web Tokens
- Joi
- Docker
- MySQL
- TypeScript
🇧🇷 Português
Esse é o sétimo projeto desenvolvido na Trybe do módulo de Back-end.
Nesse projeto desenvolvi uma API RESTful de vendas de uma loja de itens medievais em TypeScript, onde é possivel realizar as operações básicas em um banco de dados: Criar, Ler, Atualizar e Deletar (CRUD). A autenticação foi feita com JSON Web Token.
Instalação e execução com Docker
Para rodar esta aplicação é necessário ter Git, Docker e o Docker Compose instalados no seu computador. O Docker Compose precisa estar na versão 1.29 ou superior.
git clone [email protected]:apoishi/trybe-trybesmith.git
2 - Entre na pasta do repositório que você acabou de clonar e use o docker-compose para subir o container:
cd trybe-trybesmith
docker-compose up -d --build
Conecte-se ao servidor MySQL rodando na porta 3306. Utilize as seguintes credenciais:
host: db
user: root
password: password
No cliente MySQL de sua preferência, rode o script que está no arquivo Trybesmith.sql.
docker exec -it trybesmith bash
npm install
npm run dev
- Utilizei o Thunder Client como cliente de requisições HTTP e o MySQLWorkbench como cliente MySQL*
- Declarar e utilizar as tipagens do Typescript para variáveis e funções;
- Utilizar Express com Typescript;
POST /login
• Caso o login tenha sido efetuado com sucesso retorna o token para o usuário.
POST /order
• Cadastra um novo pedido.
GET /order
• Retorna todos os pedidos.
• Faz a validação do token.
POST /product
• Cadastra um novo produto.
GET /product
• Retorna todos os produtos.
POST /user
• Cadastra um novo usuário no banco de dados.
- Node
- Express
- Sequelize
- Json Web Tokens
- Joi
- Docker
- MySQL
- TypeScript