Giter Club home page Giter Club logo

java-crud-sample-machines's Introduction

This is a sample java CRUD application built on top of Spring Boot.

Building

mvn clean verify -Dskip.integration.tests=false -Dmaven.test.failure.ignore=false

Database Setup

The application is expecting a running PostgreSQL database. Connection strings can be defined in application.properties as usual.

SQL script for creating the database can be found in src/main/resources/create_db.sql

Running (on embedded tomcat)

java -jar target/homework-0.0.1-SNAPSHOT.jar

Note: Currently the embedded tomcat server is connecting to a database that is running on my home server

Sample Requests

The server is listening on port 8080 by default.

Fetch All Machines

URL: http://localhost:8080/api/machines
Request Verb: GET
Request Body: [empty]
Response Body: [empty]

Fetch a single Machine

URL: http://localhost:8080/api/machines/{id}
Request Verb: GET
Request Body: [empty]
Response Body:

{
    "id": "10112233-4455-6677-8899-aabbccddeeff",
    "name": "Test 1",
    "createdAt": "2020-09-23T22:38:00"
}

Create Machine

URL: http://localhost:8080/api/machines/{id}
Request Verb: POST
Request Body:

{
    "name": "Test 1"
}

Response Body:

{
    "id": "a2370f6e-0d0b-457c-a15f-12dd4ff11aa1",
    "name": "Test 1",
    "createdAt": "2020-09-26T02:05:41.3623474"
}

Update Machine

URL: http://localhost:8080/api/machines/{id}
Request Verb: PUT
Request Body:

{
    "id": "a2370f6e-0d0b-457c-a15f-12dd4ff11aa1",
    "name": "Renamed Test 1"
}

Response Body:

{
    "id": "a2370f6e-0d0b-457c-a15f-12dd4ff11aa1",
    "name": "Renamed Test 1",
    "createdAt": "2020-09-26T02:05:41.3623474"
}

Delete Machine

URL: http://localhost:8080/api/machines/{id}
Request Verb: DELETE
Request Body: [empty]
Response Body: [empty]

TODO

  • Configure logging as desired
  • Configure Deployment as desired (Tomcat Dedicated? Docker?)
  • Configure proper database
  • Add Continuus Integration on Github

java-crud-sample-machines's People

Contributors

vszm avatar

Watchers

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