Code up the main.py index.html and add.html so that the following requirements are met:

CHALLENGE 1

When you head over to http://locahost:5000 (or whatever shows up as your URL when you run main.py), you should have a <h1> that says My Library and link <a> to Add New Book.

e.g.

SOLUTION 1


CHALLENGE 2

When you head over to the /add path, e.g. http://locahost:5000/add you should see a form like the one below:

SOLUTION 2


CHALLENGE 3

Make the form on the /add path work so that when you click "Add Book" the book details gets added as a dictionary to the list called all_books in main.py.

The data structure of all_books should be a List of Dictionary objects. e.g

all_books = [
     {
        "title": "Harry Potter",
        "author": "J. K. Rowling",
        "rating": 9,
    }
]

SOLUTION 3


CHALLENGE 4

Make the home page show each of the books in all_books as a list item <li> in an unordered list <ul> e.g.

SOLUTION 4


CHALLENGE 5

Make the home page show <p>Library is empty.</p> if there are no books. Also, make sure the "Add New Book" link works and takes the user to the /add page.

Hint: If there are no books then all_books = []

e.g.

SOLUTION 5