Coder Social home page Coder Social logo

luisventuzelos / java-bookstore Goto Github PK

View Code? Open in Web Editor NEW

This project forked from neopragma/java-bookstore

0.0 0.0 0.0 9.73 MB

Starter code for a technical training class

License: GNU General Public License v3.0

Java 85.39% Gherkin 2.68% Ruby 11.93%

java-bookstore's Introduction

Java Bookstore

Starter project for training classes. This is a partial implementation of a sample application. It constitutes a portion of the material used in the class. The class facilitator will provide further information about what to do with it. The project is not intended for self-study, although the code may contain some useful examples.

This version of Bookstore is based on the following technologies:

  • Java 8
  • JUnit 5
  • Spring Boot
  • JPA talking to MySQL 5.7
  • Cucumber (Ruby) for API testing

Setup

1. Install MySQL

Follow the instructions to install MySQL for your platform. MySQL site

2. Clone this repository

git clone https://github.com/neopragma/java-bookstore.git

3. Create MySQL database and bookstore user

This creates a database named bookstore and a user named bookstore on localhost with a password of bookstore. This is the application's userid for MySQL.

mysql -u root -p < create_bookstore_database.sql 

4. See if the build works

Install dependencies and run unit tests.

mvn install 
mvn test 

Start the server on localhost.

If using Maven:

mvn spring-boot:run

If using Gradle:

gradle bootRun 

In a browser, navigate to http://localhost:8080. Alternatively, if you have curl and jq installed, you can run:

curl -s http://localhost:8080 | jq .

If the server returns something like the following, then you're doing OK so far.

{
  "description": "Bookstore Service",
  "version": "v1",
  "requests": [
    {
      "http-verb": "get",
      "uri": "/",
      "description": "returns api help"
    },
    {
      "http-verb": "get",
      "uri": "/v1/books",
      "description": "returns list of all books"
    },
    {
      "http-verb": "post",
      "uri": "/v1/book",
      "description": "add a book"
    },
    {
      "http-verb": "get",
      "uri": "/v1/authors",
      "description": "returns list of all authors"
    },
    {
      "http-verb": "post",
      "uri": "/v1/author",
      "description": "add an author"
    },
    {
      "http-verb": "post",
      "uri": "/v1/book/{bookId}/author/{authorId}",
      "description": "associate an author with a book"
    }
  ]
}

5. Install Postman (optional)

Postman is handy for playing with the API interactively. Postman site

If you choose to use Postman, you will find some saved API calls in Backup.postman_dump.json. That file can be imported into Postman.

User interface (optional)

This is not a UI project. The sample application is a RESTful service. A separate project can be used to explore/test/demonstrate a web-based UI for the Bookstore service. The repo for that project is here: Bookstore UI.

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.