Skip to content

An API REST builded while learning how to develop API's with Spring.

Notifications You must be signed in to change notification settings

cromega08/Spring_API_REST

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring API REST

An API REST build using SpringBoot.

Tech

  • Languages: Java.

  • DataBase: MySQL.

  • Framework: SpringBoot.

  • Libraries: SpringWeb, JPA, MySQL Driver, Lombok.

Installation

  1. Download this repo in your local machine.

  2. Create a MySQL Database with the following command:

    CREATE DATABASE your_db_name;
  3. Move inside this dir:

    cd /path_to_this_repo/src/main/resources
  4. Change this configuration and paste it inside application.properties:

    spring.datasource.url=jdbc:mysql://localhost/your_db_name?useSSL=false&serveTimeZone=UTC
    spring.datasource.username=your_user_name
    spring.datasource.password=your_user_password
    spring.datasource.driver-class=com.mysql.cj.jdbc.Driver
    spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
    spring.jpa.hibernate.ddl-auto=update
    logging.level.org.hibernate.SQL=debug

Usage

  1. Move inside the root folder of this repo.

  2. Execute the follow command:

    • MacOS/Linux:
    ./mvnw spring-boot:run
    • Windows:
    mvnw spring-boot:run
  3. Use any of the follow CRUD methods with the follow structure in your api tester or code:

    1. GET:

    2. POST:

      {
        "firstName": "first_name_as_string",
        "lastName": "last_name_as_string"
      }
    3. UPDATE:

      {
        "firstName": "new_first_name_as_string",
        "lastName": "new_last_name_as_string"
      }
    4. DELETE:

Author

License