Code Monkey home page Code Monkey logo

java-api-mvc-with-postgres's Introduction

Java API Exercise

Learning Objectives

  • Use the MVC pattern with Spring Boot to communicate with a Postgres database
  • Create an API which has a database behind it
  • Use Database Migrations and Java classes to create and model the database

Instructions

  1. Fork this repository
  2. Clone your fork to your machine
  3. Open the project in IntelliJ

Core Exercise

Look at the OpenAPI schema below, your task is to set up a remote Postgres Database on ElephantSQL and connect to it from your code, the code should use SpringBoot to respond to API requests so that it matches the schema.

The database table for Employees will be something like this:

Field Type Information
id Serial PK
name VARCHAR(250)
jobName VARCHAR(250)
salaryGrade VARCHAR(10)
department VARCHAR(50)

Create some dummy data to populate the table with and use flyway to add it to the table.

You should use Flyway, SpringBoot and the Postgres JDBC in the same way we did during the morning session to achieve this.

Add tests as usual to test the functionality of the Model layer, you do not need to test the repository code directly.

Here is the spec for the Core Criteria: Core Spec

Extension Exercise

Add in the rest of the Schema based on the OpenAPI Spec linked below, modify the original Employee table to use Foreign Keys as appropriate based on the two new tables you will create, you can use Flyway to help run the migrations and populate the tables.

Add in models and other classes to enable API calls to be made which will match the endpoints specified in the schema.

Here is the spec for the Extension Criteria: Extension Spec

java-api-mvc-with-postgres's People

Contributors

amos1969 avatar panoskar98 avatar vherus 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.