Giter Site home page Giter Site logo

sanmonsua / books-reviewing-app Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 13.1 MB

In this project I have built an application about books reviews. Users are able to register and log-in at the beginning. Then, they can explore more than 5000 books, searching by title, author, year or ISBN. By clicking in a specific book, they will get data related to the book's reviews (other users reviews, number of reviews, average rating from the app and GoodReadsApi). There they can leave their review for others to see.

Home Page: https://books-reviews-cs50-project1.herokuapp.com/

Python 37.09% CSS 16.25% HTML 46.66%
flask flask-sqlalchemy html-css bootstrap4 cs50

books-reviewing-app's Introduction

Project 1 | Web Programming with Python and JavaScript

Introduction

In this project I have built an application about books reviews. Users are able to register and log-in at the beginning. Then, they can explore more than 5000 books, searching by title, author, year or ISBN. By clicking in a specific book, they will get data related to the book's reviews (other users reviews, number of reviews, average rating from the app and GoodReadsApi). There they can leave their review for others to see.

image image

Database

For this application, I have developed a Database to manage Users, Books and Reviews. I used Heroku free postgres plan. The users table consists on a username and a password columns. The books table saves information about title, author, release year and ISBN. The reviews table save information like user id, book id, title, opinion and rating.

import.py

This file loads the 5000 books into my database. It uses SQLAlchemy library to execute this operation.

main.py

This is the Flask Application. It has the following routes:

  1. index: is the main route that lists all the books. It uses lazy loading, it loads chunks of 30 books. By accesing this route, it verify if the user is already logged in the application using the Flask session module. If it's not the case, I will redirect to the signin route

  2. signin: This route makes possible the user login. It verifies that the username and the passwords introduced are valid, and it will redirect to the index if everything is correct. If it's not the case it will throw an alet to user.

  3. signup: In this route users can register their profile in our database by introducing an username and a password.

  4. logout: This just eliminate the session and redirect to the signin route.

  5. book: By passing this route an ISBN code, it will display to the user all the information about the specific book (title, author, ISBN, release year, average rating, average rating from GoodReadsAPI, number of reviews and every review other users have made to the book). Also, the users will be able to publish their personal reviews by introducing the rate, title and opinion for the book.

  6. api: This route is the API. It receives the ISBN code of the book and it returns a json that looks like this:

  {
    'title': book.title,
    'author': book.author,
    'year': book.year,
    'isbn': book.isbn,
    'review_count': n_reviews,
    'average_rating': rating
  }

templates

Here are the differents jinja2 templates. They are

  1. layout.html: The basic template for the rest of a our html files. It just include bootstrap in our files.
  2. sign-in.html: The sign-in html file that displays the login form.
  3. sign-up.html: The sign-up html file that displays the registration form.
  4. books.html: A navbar for the application logo, search bar and the logout button. Lists all the books as cards.
  5. book.html: Displays the same navbar as the books.html file, but it displays the specific information about the book and its reviews.

static

Includes the assets folder which contain the application logo. Also, and not less important the styles.css file that gives the UI a much more modern and better looking style to the application.

books-reviewing-app's People

Contributors

sanmonsua avatar

Watchers

 avatar

Forkers

trellixvulnteam

books-reviewing-app's Issues

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.