Giter VIP home page Giter VIP logo

fruit-shop-api's Introduction

Fruit Shop API

CircleCI

A Spring Boot RESTful API modelled after the http://predic8.de API example, executing the standard set of CRUD operations on a set of data around the concept of a fruit shop.

The project allows for connection to either an H2 database (default), or a MySQL database. To change these, comment/uncomment the relevant application properties yml files.

To generate the MySQL database, tables and users, follow the SQL queries inside the file src/main/scripts/configure-mysql.sql. For the H2 database, initial data is read in via the Bootstrap class.

Unit tests are written with JUnit 5 and continuous integration testing is done through CircleCi 2.0. JacCoCo is used to provide test coverage information for the unit tests.

Requirements

  • Java 11
  • Spring Boot 2.2.1.RELEASE
  • Maven 3.6.2
  • H2/MySQL 8.0.18
  • JUnit 5

Getting started

  • Fork or clone the project.

  • Start the project server by running the command mvn spring-boot:run.

  • The API can be called with any of the following cURL CRUD-based requests (in either JSON or XML formats):

    • GET/READ:

      • curl -X GET --header 'Accept: application/json' 'http://localhost:8080/api/v1/categories/'
      • curl -X GET --header 'Accept: application/xml' 'http://localhost:8080/api/v1/categories/'
      • curl -X GET --header 'Accept: application/json' 'http://localhost:8080/api/v1/vendors/'
      • curl -X GET --header 'Accept: application/xml' 'http://localhost:8080/api/v1/vendors/'
    • CREATE/ADD:

      • curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"name": "test"}' 'http://localhost:8080/api/v1/categories/'
      • curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"name": "test"}' ''http://localhost:8080/api/v1/vendors/'
  • Check code coverage with the command mvn test jacoco:report.

API Documentation

API documentation is provided by means of Swagger2, which can be opened in the browser with the following urls:

fruit-shop-api's People

Contributors

carla-de-beer avatar

Stargazers

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