Git Product home page Git Product logo

springboot-h2's Introduction

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
    

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.