Code Monkey home page Code Monkey logo

bookshelf's Introduction

README.txt

"bookshelf" Project

Purpose

Training of a few Perl packeges - Dancer - Dancer::Plugin::DBIC - MySQL connection - Plack::Test

The Task

To construct a database and write a Dancer application with REST interface serving as a simple collection of books.

Data base

Stores two main types of data

- Books
  + title
  + author
  + publication date
  + ISBN

- Authors
  + forename
  + surname
  + country

REST interface

Enables the following routes and HTTP methods

 + /api/books/       - GET, POST
 + /api/books/:id    - GET, PUT PATCH, DELETE
 + /api/authors/     - GET, POST
 + /api/authors/:id  - GET, PUT PATCH, DELETE

Data exchange processes use JSON format.

WWW application

Is a simple interface for the end user.

The following pages are designed

+ /index.html  -- a static page with links to /books/ and /authors/
+ /books/      -- list of all books, sorted by title. Every entry has a link to a page with details of this book
+ /books/:id   -- a page with details of the selected book
+ /authors/    -- list of all authors, sorted alphabetically by surname. Every entry has a link to a page with details of this author
+ /authors/:id -- a page with details of the pointed author. Contains his/her personal data and a list of books

The WWW application is constructed as a part of the same Dancer application as the RRST interface is.

Additional requirements specify the packages to be used

+ MySQL database
+ Dancer::Plugin::DBIC
+ Plack::Test

A few tests are prepared, just as an example.

IMPLEMENTATION

Environment

* Windows 7  or  Ubuntu 16
* MySQL 5.5 or 5.7
* Dancer 1.3

Sources

* bookshell.sql - a dump of the example data base
* config.yml - DB connection info is put here.

Installation on local server

git clone https://github.com/stas53/bookshelf.git
cd bookshelf
vim config.yml
  ...  replace username and password of 'bookshell' database
mysql -p
  ...  give password
  \. bookshell.sql
\q

Running

Server
    perl bin/app.pl

Web browser
    localhost:3000/index

Additional Tests

    perl t\003_test.t
    perl t\004_test.t
    perl t\005_test.t

bookshelf's People

Contributors

stas53 avatar

Watchers

 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.