Coder Social home page Coder Social logo

library's Introduction

library

Simple RESTful Web app based on Spring framework

In order to run this application, you need following tools:

  1. JRE,JDK v.8

  2. MariaDB v.10

  3. Apache Maven 3.3.9

Pay attention, some changes required, take a look into this file src/main/resources/application.properties, change following fields: spring.datasource.username, spring.datasource.password and spring.jpa.hibernate.dialect to corresponding values of your DB.

There are no view pages, it is a simple RESTful Web App, just use HTTP requests.

To compile this app you need to run:

$ mvn clean

$ mvn compile

$ mvn package

In order to run the app, go to target/ and type

$ java -jar project-0.0.1-SNAPSHOT.jar

The app automatically creates a database called testDB1

Examples with cURL:

  1. to main page

curl http://localhost:8080/

  1. to books page

curl http://localhost:8080/books

  1. to get all books if they available

curl http://localhost:8080/books/getAll

  1. to get one book by id

curl http://localhost:8080/books/getBook/{id}

where {id} - is a numeric, for example culr http://localhost:8080/books/getBook/42 will retrieve book where id is 42

  1. to delete one book

curl http://localhost:8080/books/deleteBook/{id} -X DELETE

  1. to save new book

curl http://localhost:8080/books/saveBook -d'nameBook={str}&published={yyyy-MM-dd}&genre={str}&rating={int}&nameAuthor={str}&gender={str}&born={yyyy-MM-dd}'

where {str} - some text, {yyyy-MM-dd} - date format in text, {int} - numeric, for example: culr http://localhost:8080/books/saveBook -d 'nameBook=The Lord of the Rings&published=1954-07-29&genre=Fantasy&rating=8&nameAuthor=J. R. R. Tolkien&gender=male&born=1892-01-03'

  1. to update book by id

curl http://localhost:8080/books/updateBook/{id} -X PUT -d '{param}={value}&{param}={value} {...etc.}'

p.s. thank my brother Victor for support =)

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.