Skip to content

Latest commit

 

History

History
78 lines (60 loc) · 2.49 KB

README.md

File metadata and controls

78 lines (60 loc) · 2.49 KB

CIDADES_API

API REST QUE CONSULTA E CALCULA A DISTÂNCIA ENTRE DUAS CIDADES DO BRASIL DE ACORDO COM A SOLICITAÇÃO DO FRONTEND.

Requisitos

  • Linux
  • Java 8
  • Docker
  • IntelliJ

Base de dados

Postgres

Script de Shell

docker run --name cities-db -d -p 5432: 5432 -e POSTGRES_USER = postgres_user_city -e POSTGRES_PASSWORD = super_password -e POSTGRES_DB = cidades postgres
cd ~ / workspace / sql-countries-states-cities / PostgreSQL
docker run -it --rm --net = host -v $ PWD: / tmp postgres / bin / bash
psql -h localhost -U postgres_user_city cities -f /tmp/pais.sql psql -h localhost -U postgres_user_city cities -f /tmp/state.sql psql -h localhost -U postgres_user_city cities -f /tmp/cidade.sql psql -h localhost -U postgres_user_city cities

CREATE EXTENSION cube;
CREATE EXTENSION earthdistance;

Acesso

Script de Shell

docker exec -it cities-db / bin / bash
psql -U postgres_user_city cities

Consultar distância da Terra

point

roomsql
select ((select lat_lon from city where id = 4929) <@> (select lat_lon from city where id=5254)) as distance;

cube

roomsql
select earth_distance(
    ll_to_earth(-21.95840072631836,-47.98820114135742),
    ll_to_earth(-22.01740074157715,-47.88600158691406)
) as distance;

Spring Boot

  • Java 8
  • Gradle Project
  • Jar
  • Spring Web
  • Spring Data JPA
  • PostgreSQL Driver

Spring Data

Propriedades

Types