Giter Site home page Giter Site logo

trybe-trybesmith's Introduction

Trybesmith

🇺🇸 English

📃 About

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.


🚀 Installation

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.

1 - Clone the repository:

git clone [email protected]:apoishi/trybe-trybesmith.git

2 - Enter the repository folder you just cloned and use docker-compose to upload the container:

 cd trybe-trybesmith
 docker-compose up -d --build

3 - Run the SQL script to create the database

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.

4 - Open the trybesmith container terminal.

 docker exec -it trybesmith bash

5 - In the terminal of the container, install the dependencies with the command:

 npm install

6 - Run the application with the command:

 npm run dev
  • I used Thunder Client as a client for HTTP requests and MySQLWorkbench as a MySQL client*

👨‍💻 Skills

  • Declare and use Typescript typings for variables and functions;
  • Use Express with Typescript;

🚂 Routes

Login

POST /login
• If the login was successful, it returns a token to the user.

Order

POST /order
• Register a new order.
GET /order
• Return all orders.

• Validate the token.

Product

POST /product
• Register a new product.
GET /product
• Return all products.

User

POST /user
• Register a new user in the database.

🛠️ Tools

  • Node
  • Express
  • Sequelize
  • Json Web Tokens
  • Joi
  • Docker
  • MySQL
  • TypeScript
🇧🇷 Português

📃 Sobre

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

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.

1 - Clone o repositório:

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

3 - Execute o script SQL para criar o banco de dados

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.

4 - Abra o terminal do container trybesmith.

docker exec -it trybesmith bash

5 - No terminal do container, instale as dependências com o comando:

npm install

6 - Execute a aplicação com o comando:

npm run dev
  • Utilizei o Thunder Client como cliente de requisições HTTP e o MySQLWorkbench como cliente MySQL*

👨‍💻 Habilidades

  • Declarar e utilizar as tipagens do Typescript para variáveis e funções;
  • Utilizar Express com Typescript;

🚂 Rotas

Login

POST /login
• Caso o login tenha sido efetuado com sucesso retorna o token para o usuário.

Order

POST /order
• Cadastra um novo pedido.
GET /order
• Retorna todos os pedidos.

• Faz a validação do token.

Product

POST /product
• Cadastra um novo produto.
GET /product
• Retorna todos os produtos.

User

POST /user
• Cadastra um novo usuário no banco de dados.

🛠️ Ferramentas

  • Node
  • Express
  • Sequelize
  • Json Web Tokens
  • Joi
  • Docker
  • MySQL
  • TypeScript

trybe-trybesmith's People

Contributors

apoishi avatar trybe-tech-ops avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.