Giter Site home page Giter Site logo

agabaandre / book_inventory Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 48.14 MB

Exam XML and Web Services

License: MIT License

HTML 2.32% PHP 6.52% XSLT 0.06% CSS 8.97% JavaScript 73.84% SCSS 8.26% TeX 0.01% Handlebars 0.01% Stylus 0.01% Makefile 0.01% Shell 0.01% Less 0.01%

book_inventory's Introduction

BOOK Libary Webservice

Installation

Clone project run composer install

Files location

Controller has methods to get and add the book

BookControlle

BOOK Libary Webservice

Installation

Clone project run composer install

Files location

Controller has methods to get and add the book

BookController is lo

BOOK Libary Webservice

Installation

Clone project run composer install

Files location

Controller has methods to get and add the book

BookController is located in app/Http/BookController.php

Routes is located in routes/api.php Model is located Models/Book.php

XSD file is located in storage/schemas/book-schema.xsd


Library Book Inventory Web Service

This project is a Laravel-based web service for managing a library's book inventory. It allows clients to add new books and retrieve details about existing books using XML for data exchange.

Table of Contents

Requirements

  • PHP >= 7.4
  • Composer
  • Laravel 8 or later
  • MySQL or another supported database

Installation

  1. Clone the repository:

    git clone https://github.com/agabaandre/book_inventory.git
    cd library-book-inventory
  2. Install dependencies:

    composer install
  3. Create a copy of the .env file:

    cp .env.example .env
  4. Configure your .env file with your database credentials:

    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=your_database
    DB_USERNAME=your_username
    DB_PASSWORD=your_password
  5. Generate an application key:

    php artisan key:generate
  6. Run database migrations:

    php artisan migrate
  7. Start the development server:

    php artisan serve
  8. Serve the HTML client:

    • Save the add-book.html file in the public directory of your Laravel project.
    • Access the client through http://localhost:8000/add-book.html if using Laravel's built-in server.

File Structure

  • app/Http/Controllers/BookController.php: Controller handling book-related requests.
  • app/Models/Book.php: Eloquent model representing a book.
  • database/migrations/xxxx_xx_xx_create_books_table.php: Migration file for creating the books table.
  • storage/schemas/book-schema.xsd: XML Schema definition for book data.
  • public/add-book.html: HTML client for adding and retrieving books.

Usage

Adding a New Book

  1. Open the HTML client in your browser:

    http://localhost:8000/add-book.html
    
  2. Fill in the book details in the "Add New Book" form and click "Add Book".

Retrieving Book Details

  1. Open the HTML client in your browser:

    http://localhost/client_app/client.html
    
  2. Enter the ISBN of the book in the "Get Book Details" form and click "Get Book Details".

API Endpoints

Add a New Book

  • URL: /add-book
  • Method: POST
  • Content-Type: application/x-www-form-urlencoded
  • Parameters:
    • xml (string): XML representation of the book data.

Example Request:

<book>
  <title>Example Book Title</title>
  <author>Author Name</author>
  <isbn>1234567890</isbn>
  <publicationYear>2024</publicationYear>
  <publisher>Example Publisher</publisher>
</book>

Get Book Details by ISBN

  • URL: /book/{isbn}
  • Method: GET
  • Response: XML representation of the book data.

Example Response:

<book>
  <title>Example Book Title</title>
  <author>Author Name</author>
  <isbn>1234567890</isbn>
  <publicationYear>2024</publicationYear>
  <publisher>Example Publisher</publisher>
</book>

License

This project is open-source and available under the MIT License.

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.