This project is a RESTful web application utilizing the Flask framework which accesses a SQL database that populates categories and their items. OAuth2 provides authentication for further CRUD functionality on the application. Currently OAuth2 is implemented for Google Accounts.
This project has one main Python module application.py
which runs the Flask application. A SQL database is created using the database_setup.py
module. The Flask application uses stored HTML templates in the tempaltes folder to build the front-end of the application. CSS/JS/Images are stored in the static directory.
- Install Vagrant & VirtualBox
- Download or clone Udacity Vagrant file (https://github.com/udacity/fullstack-nanodegree-vm)
- Download this repository
- Go to catalog inside Vagrant directory and place unzip file from step 3 here
- Open Terminal
- Go to Vagrant
/cd vagrant
directory, runvagrant up
- Log into Vagrant VM by run
vagrant ssh
- Run
cd /vagrant/catalog
- Setup application database python by running
python database_setup.py
- Run application
python application.py
- Access the application locally using http://localhost:5000
- Go to Google Dev Console (https://console.developers.google.com/)
- Sign up or Login if prompted
- Go to Credentials
- Select Create Crendentials > OAuth Client ID
- Select Web application
- Enter name 'Restaurant Menu Application'
- Authorized JavaScript origins = 'http://localhost:5000'
- Authorized redirect URIs = 'http://localhost:5000/login'
- Select Create
- Copy the Client ID and paste it into the data-clientid in login.html
- On the Dev Console Select Download JSON
- Rename JSON file to client_secrets.json
- Place JSON file in the catalog directory
- Run application
python application.py
-
Restaurant JSON: /restaurant/JSON - Displays all restaurants.
-
Menu JSON: /restaurant/int:restaurant_id/menu/JSON - Displays all items in menu
-
Items JSON: /restaurant/int:restaurant_id/menu/int:menu_id/JSON/ - Displays specific item in the menu