Git Product home page Git Product logo

place-service's Introduction

Place Service

@giulianabezerra Desafio

API para gerenciar lugares (CRUD) que faz parte desse desafio para pessoas desenvolvedoras backend que se candidatam para a ClickBus.

O projeto foi elaborado nesse vídeo.

Tecnologias

Práticas adotadas

  • SOLID
  • Testes automatizados
  • Consultas com filtros dinâmicos usando o Query By Example
  • API reativa na web e na camada de banco
  • Uso de DTOs para a API
  • Injeção de Dependências
  • Geração automática do Swagger com a OpenAPI 3
  • Geração de slugs automática com o Slugify
  • Auditoria sobre criação e atualização da entidade

Como Executar

Localmente

  • Clonar repositório git
  • Construir o projeto:
./mvnw clean package
  • Executar:
java -jar place-service/target/place-service-0.0.1-SNAPSHOT.jar

A API poderá ser acessada em localhost:8080. O Swagger poderá ser visualizado em localhost:8080/swagger-ui.html

Usando Docker

  • Clonar repositório git
  • Construir o projeto:
./mvnw clean package
  • Construir a imagem:
./mvnw spring-boot:build-image
  • Executar o container:
docker run --name place-service -p 8080:8080  -d place-service:0.0.1-SNAPSHOT

A API poderá ser acessada em localhost:8080. O Swagger poderá ser visualizado em localhost:8080/swagger-ui.html

API Endpoints

Para fazer as requisições HTTP abaixo, foi utilizada a ferramenta httpie:

  • POST /places
http POST :8080/places name="Place" state="State"

HTTP/1.1 200 OK
Content-Length: 129
Content-Type: application/json

{
    "createdAt": "2023-04-20T19:00:07.241632",
    "name": "Place",
    "slug": "place",
    "state": "State",
    "updatedAt": "2023-04-20T19:00:07.241632"
}
  • GET /places/{id}
http :8080/places/1
HTTP/1.1 200 OK
Content-Length: 129
Content-Type: application/json

{
    "createdAt": "2023-06-07T14:45:39.693689",
    "name": "Place",
    "slug": "place",
    "state": "State",
    "updatedAt": "2023-06-07T14:45:39.693689"
} 
  • GET /places?name=?
http :8080/places name==PLACE
HTTP/1.1 200 OK
Content-Type: application/json
transfer-encoding: chunked

[
    {
        "createdAt": "2023-06-07T14:45:39.693689",
        "name": "Place",
        "slug": "place",
        "state": "State",
        "updatedAt": "2023-06-07T14:45:39.693689"
    }
]
  • PATCH /places/{id}
http PATCH :8080/places/1 name='New Name' state='New State'
HTTP/1.1 200 OK
Content-Length: 142
Content-Type: application/json

{
    "createdAt": "2023-06-07T14:45:39.693689",
    "name": "New Name",
    "slug": "new-name",
    "state": "New State",
    "updatedAt": "2023-06-07T14:53:21.671129345"
}

place-service's People

Contributors

giuliana-bezerra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.