A RESTful web application created with Flask framework. For data operations, it uses SQLite database and SQLAlchemy ORM. In addition, OAuth2 is implemented using Google that provides authentication for further CRUD functionality on the application.
- Python
- HTML
- CSS
- OAuth
- Flask Framework
- Jinja2
- SQLAlchemy
In order to run this application you need python 3 with SQLAlchemy and Flask installed. In addition you need to configure things on Google for authentication and authorization functionalities.
- Python 3
- Flask
- SQLAlchemy
- YAML
Two files are provided to get started with the database.
- Run the
database_setup.py
insidesrc/utils/
to create the database - It's optional, but you can run the
populate_database.py
to populate the database with dummy data
To get the Google login working follow these steps:
- Go to Google Dev Console and select Credentials
- Select Create Crendentials, then OAuth Client ID and Select Web application
- Enter name
Item Catalog Web Client
- Authorized JavaScript origins =
http://localhost:8081
- Authorized redirect URIs =
http://localhost:8081/oauth2callback
- Select Create
- Create a file named
params.yaml
from the included templated in this repo(params_template.yaml)
and replacexxxx
with the Client ID - On the Dev Console Select Download JSON and rename the JSON file to client_secrets.json and place it in the root directory of this repo
In order to run the the service run the app.py
inside the src
directory. You can visit the app by visiting: http://localhost:8081/
Catalog JSON: /catalog
- Returns the whole catalog data in JSON format
/
or /categories
- Not logged in
- Logged in (Add item link appears, login button changes to logout)
/new_item
(User should be logged in)
/{category_id}/items
/{category_id}/{item_id}
- To check the details on an item. If the logged in user is the owner of the item, the user can edit or delete the item.
/{category_id}/{item_id}/edit
- Editing an item (User should be the owner of the item)
/{category_id}/{item_id}/delete
- Deleting an item (User should be the owner of the item)
/login
- Login to the app using a Google account