Skip to content

Latest commit

 

History

History
90 lines (75 loc) · 1.76 KB

README.md

File metadata and controls

90 lines (75 loc) · 1.76 KB

Spring - MySql - Redis

Spring Boot Mysql Redis REST API Cache example Project for FIAP MBA Persistence

Prerequisites

  • JDK 1.8
  • Maven
  • Mysql
  • Redis
  • Docker

Quick Start

Clone source

$ git clone https://github.com/lucmkz/spring-mysql-redis.git

Run Docker

$ cd spring-mysql-redis
$ docker-compose up
- Start MySQL
- Start Redis

Swagger-ui REST API Reference & Test

TEST using CURL

  • Create Costumer
$ curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '  { \ 
     "deliveryAddress": "Rua Lins de Vasconcelos, 1", \ 
     "documentId": 10101010, \ 
     "houseAddress": "São Bento, 1", \ 
     "name": "Lucas", \ 
     "nationality": "Brazil" \ 
 }' 'http://localhost:8080/v1/costumer'
  • Create Product (1)
$ curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '  { \ 
     "code": "999", \ 
     "name": "Leite", \ 
     "quantity": 100, \ 
     "value": 20 \ 
   }' 'http://localhost:8080/v1/products'
  • Create Product (2)
$ curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '  { \ 
     "code": "999", \ 
     "name": "Pão", \ 
     "quantity": 1000, \ 
     "value": 10 \ 
   }' 'http://localhost:8080/v1/products'
  • Create Order
$ curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \ 
   "product": [ \ 
     { \ 
       "id": "1" \ 
     }, \ 
     { \ 
       "id": "2" \ 
     } \ 
   ], \ 
   "costumer": { \ 
 		"id":	"1" \ 
 	} \ 
 }' 'http://localhost:8080/v1/order'

Redis monitor