by Riley Starnes and Mike Mahone
Build a library catalog website where users can view books and patrons. Practice CRUD functionality with Ruby, Sinatra, and psql to manipulate data in a Postgres database. Practice RESTful routing and Behavior Driven Development.
Clone the Repository
git clone https://github.com/Rilsta/Library-System-Ruby.git
- Navigate to project directory
Install the ruby gems
$bundle install
Set up the database by running the following:
$psql
CREATE DATABASE library_system
\c library_system
CREATE TABLE patrons (id serial PRIMARY KEY, name varchar)
CREATE TABLE books (id serial PRIMARY KEY, author varchar, genre varchar, title varchar)
CREATE TABLE checkouts (id serial PRIMARY KEY, patron_id integer, book_id integer)
For testing, stay in psql and run the following
CREATE DATABASE library_system_test WITH TEMPLATE library_system
- exit psql and run
$rspec
To view:
ruby app.rb
- Open a web browser and navigate to localhost:4567
MIT License 2016