Skip to content

fabiofaleiros/placeservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Place Service

@DevCollab Challenge

API to manage places (CRUD) challenge

Vídeo source link.

Technologies

Adopted practices

  • SOLID
  • Automated tests
  • Dynamic filter with Query By Example
  • Reactive API (Web + DB)
  • Uso de DTOs para a API
  • Dependency injection
  • Swagger automatic doc wit OpenAPI 3
  • Automatic slug generation with Slugify
  • Entity Auditing to date(create and update)

How to load

Locally

./mvnw clean package
  • Execute:
java -jar place-service/target/place-service-0.0.1-SNAPSHOT.jar

Link API localhost:8080. Swagger (OpenAPI 3) documentation: localhost:8080/swagger-ui.html

Using docker

./mvnw clean package
  • Build docker image:
./mvnw spring-boot:build-image
  • Run container:
docker run --name place-service -p 8080:8080  -d place-service:0.0.1-SNAPSHOT

Link API localhost:8080. Swagger (OpenAPI 3) documentation: localhost:8080/swagger-ui.html

API Endpoints

Tool postman:

  • POST localhost:8080/places
Request:
{
    "name": "New One",
    "city": "New City",
    "state": "New State"
}

HTTP/1.1 201 CREATED
Content-Type: application/json

{
    "name": "New One",
    "slug": "new-one",
    "city": "New State",
    "state": "New City",
    "createdAt": "2023-09-22T18:19:54.1250719",
    "updatedAt": "2023-09-22T18:19:54.1250719"
}
  • GET localhost:8080/places
HTTP/1.1 200 OK
Content-Type: application/json

[
    {
        "name": "New One",
        "slug": "new-one",
        "city": "New State",
        "state": "New City",
        "createdAt": "2023-09-22T18:19:27.476613",
        "updatedAt": "2023-09-22T18:19:27.476613"
    }
]
  • GET localhost:8080/places/1
HTTP/1.1 200 OK
Content-Type: application/json

{
    "name": "New One",
    "slug": "new-one",
    "city": "New State",
    "state": "New City",
    "createdAt": "2023-09-22T18:19:27.476613",
    "updatedAt": "2023-09-22T18:19:27.476613"
} 
  • GET localhost:8080/places?name=New One
HTTP/1.1 200 OK
Content-Type: application/json
transfer-encoding: chunked

[
    {
        "name": "New One",
        "slug": "new-one",
        "city": "New State",
        "state": "New City",
        "createdAt": "2023-09-22T18:19:27.476613",
        "updatedAt": "2023-09-22T18:19:27.476613"
    }
]
  • PATCH localhost:8080/places/1
Request:
{
    "name": "New One Name",
    "city": "New City Name",
    "state": "New State Name"
}

HTTP/1.1 200 CREATED
Content-Type: application/json

{
    "name": "New One Name",
    "slug": "new-one-name",
    "city": "New State Name",
    "state": "New City Name",
    "createdAt": "2023-09-22T18:19:27.476613",
    "updatedAt": "2023-09-22T18:31:13.3329751"
}
  • PUT localhost:8080/places/1
Request:
{
    "name": "New One Name",
    "city": "New City Name",
    "state": "New State Name"
}

HTTP/1.1 200 CREATED
Content-Type: application/json

{
    "name": "New One Name",
    "slug": "new-one-name",
    "city": "New State Name",
    "state": "New City Name",
    "createdAt": "2023-09-22T18:19:27.476613",
    "updatedAt": "2023-09-22T18:31:13.3329751"
}

About

Place Service API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages