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.
Some technologies used in this API:
- Node.js
- Express
- Multer
- TypeScript
- TypeORM
- PostgreSQL
- MongoDB
- Redis
- JWT-token
- uuid v4
- Date-fns
- Jest
- nodemailer
- tsyringe
- handlebars
Before downloading and running the project, you must have Node.js already installed and then install the following tools:
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
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
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.
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
- 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.
-
POST /users
: Register a new user. -
GET /profile
: Show profile. -
PATCH /users/avatar
: Update the user's avatar. -
PUT /profile
: Update profile.
POST /sessions
: User authentication.
-
POST /password/forgot
: Password recovery. -
POST /password/reset
: Change Password.
-
POST /appointments
: register a new appointment. -
GET /appointments/me
: show the provider's appointments.
-
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.
This is a RocketSeat GoStack course project.