Skip to content

Atualização da API do GoBarber totalmente refatorada utilizando importantes recursos como tipagem com typescript, princípios do SOLID, TDD para testes, gerenciamento de cache, etc.

Notifications You must be signed in to change notification settings

marchetti2/gobarber-node-new-version

Repository files navigation

About

This is the new version of GoBarber, from RocketSeat course. In relation to the previous project, this new version has been totally refactored using important resources such as typescript typing, programming features with SOLID, TDD for tests, cache management, and other standards.

GoBarber is an application designed for service management between barbers and customers.

With Gobarber it is possible to register and make an appointment/service with your barber and/or become a provider of these services.

This repository is only the backend of the application, the web and mobile versions are part of the next modules.

To see the old version of GoBarber, click here.

Summary

Technologies

Some technologies used in this API:

Tools
REST API Client

Getting started

Before downloading and running the project, you must have Node.js already installed and then install the following tools:

Download

Open the terminal and execute the following commands:

  # Clone the project
  $ git clone https://github.com/marchetti2/gobarber-node-new-version.git

  # Access the folder
  $ cd gobarber-node-new-version

  # Install the dependencies
  $ yarn

Environment

Databases

Using the docker, start an instance of the databases below.

  # PostgreSQL 
  $ docker run --name postgres -e POSTGRES_PASSWORD=docker -p 5432:5432 -d postgres

  # MongoDB
  $ docker run --name mongodb -p 27017:27017 -d -t mongo

  # Redis
  $ docker run --name redis -p 6379:6379 -d -t redis:alpine

To find out if the databases are running, run the following command:

$ docker ps

If not, run:

$ docker start postgres mongodb redis
Environment variables

From the .env.example file at the root of the project, create another file called .env using the same structure and set with your environment variables.

Running the API

First, verify that the databases are running. From the API directory, run the following commands:

  # Create tables in PostgreSQL
  $ yarn typeorm migration:run

  # Run the server
  $ yarn dev:server
Tools
  • To view the tables created in the postgres database, use DBeaver.
  • To manage notifications, use MongoDB Compass.
  • To test the routes, you can use Insomnia. The workspace used in this API is available, just click the button below.

Run in Insomnia

Routes

User
  • POST /users: Register a new user.

  • GET /profile: Show profile.

  • PATCH /users/avatar: Update the user's avatar.

  • PUT /profile: Update profile.

Sessions
  • POST /sessions: User authentication.
Password
  • POST /password/forgot: Password recovery.

  • POST /password/reset: Change Password.

Appointments
  • POST /appointments: register a new appointment.

  • GET /appointments/me: show the provider's appointments.

Providers
  • GET /providers: Show available providers.

  • POST /providers/:provider_id/month-availability: Show the available month of the provider informed by the route params.

  • POST /providers/:provider_id/day-availability: Show the available day of the provider informed by the route params.

License

This is a RocketSeat GoStack course project.

About

Atualização da API do GoBarber totalmente refatorada utilizando importantes recursos como tipagem com typescript, princípios do SOLID, TDD para testes, gerenciamento de cache, etc.

Topics

Resources

Stars

Watchers

Forks