Giter Site home page Giter Site logo

spring-rest-api-mysql-bdd's Introduction

spring-rest-api-mysql-bdd

Spring Rest API with MySQL sample to create, update, list and remove records using some bdd approaches

Quick start

Follow the instructions bellow to run th project localy.

Requirements

You will need the JDK 11 installed to compile the project. You will need the Apache maven Version 3.5.4 installed to compile the project

About this project

This is a Spring Boot Maven RestFul API whitch uses MySQL database to store the worstest movies winners for Golden Raspberry Awards

Changing Initial Data Source

To change the initial Data Source replace the src/main/resources/initialdatasource.csv file content

Composing your MySQL Enviroment

Access the project folder and run

docker-compose up -d

Docker will create two images linked by the network "logon-compose-network"

  • my-sql image link your computer port 3306 to docker port 3306 under network "logon-compose-network" ana mantains your volume (see docker compose file)

  • mysql-workbench image link your computer port 3000 to docker port 3000 under network "logon-compose-network"

To access MySQL Workbench throw your browser acess http://localhost:3000

Inside MySQL Workbench create a new connection to your MySQL database by de following steps:

  • Create a connection to MySQL using the host my-sql (host name inside "logon-compose-network")
  • Set 'logon' as database name
  • Set 'logon' as user name
  • Set 'logon' as password

Running the project

 mvn spring-boot:run

Access H2 in memory database

jdbc url = jdbc:h2:mem:testdb
user name = sa
password = password

Restful Local API

Thi api is on staging enviroment, after 30 minutes of inactivitie it stand by

Busca Todos os Fornecedores

curl --location --request GET 'http://localhost:8080/api/fornecedores'

Busca Fornecedor pelo Id

curl --location --request GET 'http://localhost:8080/api/fornecedores/1'

Atualiza Fornecedor pelo Id

curl --location --request PUT 'http://localhost:8080/api/fornecedores/1' \
--header 'Content-Type: application/json' \
--data-raw '{
"nome":"jaaziel"
}'

Cria Fornecedor

curl --location --request POST 'http://localhost:8080/api/fornecedores' \
--header 'Content-Type: application/json' \
--data-raw '{
    "nome":"joal",
    "cnpj":"123456789"
}'

spring-rest-api-mysql-bdd's People

Contributors

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