项目作者: rajashekar

项目描述 :
A RESTful web application to display categories and items and gives logined user to edit or add items.
高级语言: Python
项目地址: git://github.com/rajashekar/item-catalog.git
创建时间: 2018-03-29T06:06:11Z
项目社区:https://github.com/rajashekar/item-catalog

开源协议:

下载


item-catalog

The purpose of the project is to understand the concepts Python framework Flask along with implementing third-party OAuth authentication and to develop a RESTful web application to display categories and items and gives logined user to edit or add items.

Getting Started

Prerequesites

Below software needs to be installed

  • Python
  • Virtual Box
  • Vagrant

    Installing

    To download the virtual machine using vagrant file

    1. git clone https://github.com/udacity/fullstack-nanodegree-vm.git

    To install downloaded virtual machine

    1. cd fullstack-nanodegree-vm
    2. vagrant up

    To login to vagrant virtual machine

    1. vagrant ssh

    How to Run

    1. git clone https://github.com/rajashekar/item-catalog.git
    2. cd item-catalog
    3. python catalog_views.py

    open http://localhost:5000/

Demo

Available json endpoints

http://localhost:5000/catalog.json

  1. {
  2. "categories": [
  3. {
  4. "id": 1,
  5. "items": [
  6. {
  7. "category": "TV",
  8. "description": "Samsung TV 55 inch 4K",
  9. "id": 1,
  10. "modified_date": "Sun, 15 Apr 2018 06:40:28 GMT",
  11. "title": "Samsung TV",
  12. "user_id": 1
  13. },
  14. {
  15. "category": "TV",
  16. "description": "LG TV 55 inch 4K",
  17. "id": 2,
  18. "modified_date": "Sun, 15 Apr 2018 06:40:28 GMT",
  19. "title": "LG TV",
  20. "user_id": 1
  21. }
  22. ],
  23. "name": "TV"
  24. },
  25. {
  26. "id": 2,
  27. "items": [
  28. {
  29. "category": "Gaming Console",
  30. "description": "Console game by Sony",
  31. "id": 3,
  32. "modified_date": "Sun, 15 Apr 2018 06:40:28 GMT",
  33. "title": "Sony playstation 4",
  34. "user_id": 1
  35. },
  36. {
  37. "category": "Gaming Console",
  38. "description": "Console game by Microsoft",
  39. "id": 4,
  40. "modified_date": "Sun, 15 Apr 2018 06:40:28 GMT",
  41. "title": "Xbox one",
  42. "user_id": 1
  43. },
  44. {
  45. "category": "Gaming Console",
  46. "description": "Console game by Nintendo",
  47. "id": 5,
  48. "modified_date": "Sun, 15 Apr 2018 06:40:28 GMT",
  49. "title": "Nintendo",
  50. "user_id": 1
  51. }
  52. ],
  53. "name": "Gaming Console"
  54. }
  55. ]
  56. }

http://localhost:5000/items.json

  1. {
  2. "items": [
  3. {
  4. "category": "TV",
  5. "description": "Samsung TV 55 inch 4K",
  6. "id": 1,
  7. "modified_date": "Sun, 15 Apr 2018 06:40:28 GMT",
  8. "title": "Samsung TV",
  9. "user_id": 1
  10. },
  11. {
  12. "category": "TV",
  13. "description": "LG TV 55 inch 4K",
  14. "id": 2,
  15. "modified_date": "Sun, 15 Apr 2018 06:40:28 GMT",
  16. "title": "LG TV",
  17. "user_id": 1
  18. },
  19. {
  20. "category": "Gaming Console",
  21. "description": "Console game by Sony",
  22. "id": 3,
  23. "modified_date": "Sun, 15 Apr 2018 06:40:28 GMT",
  24. "title": "Sony playstation 4",
  25. "user_id": 1
  26. },
  27. {
  28. "category": "Gaming Console",
  29. "description": "Console game by Microsoft",
  30. "id": 4,
  31. "modified_date": "Sun, 15 Apr 2018 06:40:28 GMT",
  32. "title": "Xbox one",
  33. "user_id": 1
  34. },
  35. {
  36. "category": "Gaming Console",
  37. "description": "Console game by Nintendo",
  38. "id": 5,
  39. "modified_date": "Sun, 15 Apr 2018 06:40:28 GMT",
  40. "title": "Nintendo",
  41. "user_id": 1
  42. }
  43. ]
  44. }

http://localhost:5000/catalog/\/items/json

Example -
http://localhost:5000/catalog/TV/items/json

  1. {
  2. "items": [
  3. {
  4. "category": "TV",
  5. "description": "Samsung TV 55 inch 4K",
  6. "id": 1,
  7. "modified_date": "Sun, 15 Apr 2018 06:40:28 GMT",
  8. "title": "Samsung TV",
  9. "user_id": 1
  10. },
  11. {
  12. "category": "TV",
  13. "description": "LG TV 55 inch 4K",
  14. "id": 2,
  15. "modified_date": "Sun, 15 Apr 2018 06:40:28 GMT",
  16. "title": "LG TV",
  17. "user_id": 1
  18. }
  19. ]
  20. }

http://localhost:5000/catalog/\/\/json

http://localhost:5000/catalog/TV/LG%20TV/json

  1. {
  2. "item": {
  3. "category": "TV",
  4. "description": "LG TV 55 inch 4K",
  5. "id": 2,
  6. "modified_date": "Sun, 15 Apr 2018 06:40:28 GMT",
  7. "title": "LG TV",
  8. "user_id": 1
  9. }
  10. }