Giter Club home page Giter Club logo

superhero-app's Introduction

superhero-app

Create an account and search superheros using an external API, and add them to favorites. The app is called "Find A Hero".

The API that the app calls is https://superheroapi.com/

The language of this app mostly consists of Python, some Javascript/JQuery. For the databse and server Postgesql 13 and Flask SQLAlchemy are used for a full CRUD app.

The modles.py is where the tables live along with a function that connects the app.py to the database. There are two modles, one for users loging in and one for favorited superheros. Using flask_bcrypt the users password is hashed when stored. These two tables have a relationship being the user_id.

The app.py calls the function from modles to connect to the database. The first route is just a blank index, and the second one is /superheros. This is where https://superheroapi.com/ is called. Using a form's name and parsing out the json. By creating an object with the data it will be displayed on a the index template. The favorites route just querys all superheros from the table and displays them on a template. The register and login routes use WTForms to store and authenticate data. api/superheros is an in house api that is used to get, post, and delete superheros from the database.

Bootstrap was used for most of the styling. The base.html holds the links, navbar, and flashed messages, which are chained to all the other templates. The index just contains a form, which is the one used to call https://superheroapi.com/. Once a superheros name is searched, it's displayed under the form using a card. Its shows the heros image, name, place of birth, and powerstats. At the bottom of the card, is a button that once clicked stores the hero in the Favoritehero modle. The favorites templates consists of a table that holds all favorited heros. It displays their image, name and a button for deleteing. When the button is hit, it is deleted from the table as well as the database. The login and register templates just display the forms, title, and flashed mesages for logging in or errors.

JQuery was used for a some handler functions. One in particular being the delete button on the favorites table. Using an aysnc function with await axios.delete the superhero is deleted from the DB and DOM. Styles.css holds a some styling for the aplication. The test.py holds a few tests using unittests and TestCase. Requirments.txt holds all the tools need for this project.

So basically a user creates an account and logs in. Then searches a superhero by name from a form, which is diplayed once searched. If the user likes the hero they can click the button on the bottom of the card, and add it to favorites. Once they are done searching they can go to the favorites page (which is only accesed once logged in), to view thier favorites. There then can view them and say WOOOOWWWWW or say NAHHHHHH and delete them. Thanks for reading!

superhero-app's People

Contributors

lambit 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.