Skip to content

REST API Travel with Node.js, Express.js, Sequelize, Sucrase, Swagger, Docker and PostgresSQL

Notifications You must be signed in to change notification settings

naldomadeira/rest-api-travel

Repository files navigation

REST API Travel with Node.js, Express.js, Sequelize, Sucrase, Swagger, Docker and PostgresSQL

[IMAGE_REPOSITORY

API RESTful - Tourism agency specialized in bringing tourists from around the world to visit Brazil's beaches, savannahs and forests

Docker NODEEXPRESSGITHUB YARN POSTGRES VSCODE

Components

  • NodeJs
  • Insomnia
  • Container Docker Postgres
  • Postbird
  • Swagger

Dependecies

  • Express
  • Sequelize
  • Nodemon
  • Sucrase
  • Eslint
  • Prettier
  • dotEnv
  • Cors

Usage

  1. Clone the application
$ https://github.com/naldomadeira/rest-api-travel.git
$ cd rest-api-travel
$ yarn install

Project setup it is necessary to rename .env.example for .env and make the necessary adjustments to connect your database

  1. Create docker container PostgresSQL
$ docker run --name database -e POSTGRES_PASSWORD=docker -p 5432:5432 -d postgres
  1. After configuring and creating the database,execute migrations

3.1. Run the script create the database with the name traveldb in the container named database

$ docker exec -it database psql -U postgres -c "CREATE DATABASE traveldb;"
$ docker exec -it database psql -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE postgres TO postgres;"

3.2. Run sequelize-cli to run the migrations

$ yarn sequelize db:migrate

4.Use the command below to start the project:

$ yarn dev

5.Run the project and access the documentation at: http://localhost:3333/api/doc

Database Model

database-api-travel

Tests

They were entirely carried out in the automated environment of insomnia. Insomnia is an extremely useful tool for testing manually or automating the testing of any REST API.

insomnia-api-rest-travel

Screenshots

row-1-col-1 row-2-col-1 row-3-col-1 row-4-col-1 row-5-col-1 row-6-col-1 row-7-col-1

Credits

This API was developed by Francinaldo Madeira

Linkedin Badge