Skip to content

hoiast/SpringBoot-H2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpringBoot-H2

A simple CRUD using SpringBoot and H2 database. This project is bootstrapped using spring initializr and built with Maven and Kotlin.

A simple function for detection of duplicates in a list of integers is available at the /duplicates endpoints. For example, a list [1,1,2] would return another list with only the repeating elements [1,1]. Please read more below for instructions how to start and test this application.

Getting Started

  • Clone this repository.
  • Open the Maven project in your favorite IDE.
  • Ensure that all the dependencies are downloaded.
  • Run the application. The default port is 8080.
  • Use Postman, ThunderClient or any other client to test the endpoints.

Endpoints

  • GET /duplicates/
    Returns all the duplicates entries registered in the in-memory database.

    Example: GET /duplicates/
    Response 200 OK 
    [
      {
        "id": 1,
        "input": "[1, 1, 1, 1, 4, 5, 6, 6]",
        "output": "[1, 1, 1, 1, 6, 6]"
      },
      {
        "id": 2,
        "input": "[2, 3, 3, 4]",
        "output": "[3, 3]"
      },
      {
        "id": 3,
        "input": "[1, 4, 5, 6]",
        "output": "[]"
      }
    ]
    
  • GET /duplicates/{id}
    This endpoint returns a specific duplicate by its id.

    Example: GET /duplicates/2
    Response 200 OK
    {
      "id": 2,
      "input": "[2, 3, 3, 4]",
      "output": "[3, 3]"
    }
    
  • POST /duplicates/
    Submit a string representing a list of integers to return the duplicates in the list.

    Example: POST /duplicates/
    
    Body:
    {
      "input": "[1, 1, 1, 1, 4, 5, 6, 6]"
    }
    
    Response 201 Created:
    {
      "id": 1,
      "input": "[1, 1, 1, 1, 4, 5, 6, 6]",
      "output": "[1, 1, 1, 1, 6, 6]"
    }
    
  • DELETE /duplicates/{id}
    This endpoint deletes a specific duplicate by its id.

    Example: DELETE /duplicates/2
    Response: 204 No Content
    

About

A simple CRUD using SpringBoot and H2 database.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages