SanjeevB1 commited on
Commit
ce73693
·
verified ·
1 Parent(s): 5043f2f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +99 -0
README.md CHANGED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Sanjeev's Favorite Drinks
3
+ emoji: 🥤
4
+ colorFrom: red
5
+ colorTo: purple
6
+ sdk: docker
7
+ app_file: app.py
8
+ pinned: false
9
+ ---
10
+
11
+ # Sanjeev's Favorite Drink API
12
+
13
+ This is a REST API with full CRUD (Create, Read, Update, Delete) operations that lets you manage a list of drinks. It is hosted on Hugging Face Spaces and serves as a fun way to access and explore my favorite drinks.
14
+
15
+ The API includes features such as retrieving the list of all drinks, getting details of a specific drink, adding new drinks, and deleting them. Note that due to the hosting limitations of Hugging Face Spaces, POST and DELETE operations are currently disabled.
16
+
17
+ ## API Summary
18
+
19
+ | HTTP Method | Endpoint | Description |
20
+ |-------------|----------------|--------------------------------------------------|
21
+ | GET | `/` | Returns a list of all drinks. |
22
+ | GET | `/drinks` | Same as `/`, returns all drinks. |
23
+ | GET | `/drinks/<id>` | Returns details of a specific drink by its ID. |
24
+ | POST | `/drinks` | Add a new drink (not supported on Hugging Face).|
25
+ | DELETE | `/drinks/<id>` | Delete a drink (not supported on Hugging Face). |
26
+
27
+ ---
28
+
29
+ ## Database Design
30
+
31
+ | Column | Type | Description |
32
+ |-------------|-------------|-------------------------------------|
33
+ | `id` | INTEGER | Unique identifier (Primary Key). |
34
+ | `name` | STRING(80) | Name of the drink (must be unique). |
35
+ | `description`| STRING(120)| Short description of the drink. |
36
+
37
+ ---
38
+
39
+ ## 🚀 How It Works
40
+
41
+ The API uses Flask and SQLAlchemy. The data is stored in a SQLite database. Flask handles the incoming HTTP requests, queries the database, and returns the corresponding responses. CRUD operations can be performed locally, while only GET operations are supported on Hugging Face Spaces due to the read-only database restrictions.
42
+
43
+ ## Usage Instructions
44
+
45
+ ### View All Drinks
46
+ - **Method**: `GET`
47
+ - **URL**: [https://sanjeevb1-drinks.hf.space/drinks](https://sanjeevb1-drinks.hf.space/drinks)
48
+ - **Example Response**:
49
+ ```json
50
+ {
51
+ "drinks": [
52
+ {
53
+ "name": "Diet Coke",
54
+ "description": "Tastes like Coke with no calories, great!!!"
55
+ },
56
+ {
57
+ "name": "Fanta",
58
+ "description": "Like the taste and color of it"
59
+ }
60
+ ]
61
+ }
62
+ ```
63
+
64
+ ### View a Specific Drink
65
+ - **Method**: `GET`
66
+ - **URL**: [https://sanjeevb1-drinks.hf.space/drinks/1](https://sanjeevb1-drinks.hf.space/drinks/1)
67
+ - **Example Response**:
68
+ ```json
69
+ {
70
+ "name": "Diet Coke",
71
+ "description": "Tastes like Coke with no calories, great!!!"
72
+ }
73
+ ```
74
+
75
+ ### Add a New Drink (Not Supported on Hugging Face Spaces)
76
+ - **Method**: `POST`
77
+ - **URL**: `/drinks`
78
+ - **Body (JSON)**:
79
+ ```json
80
+ {
81
+ "name": "Mango Juice",
82
+ "description": "Sweet and refreshing"
83
+ }
84
+ ```
85
+
86
+ ### Delete a Drink (Not Supported on Hugging Face Spaces)
87
+ - **Method**: `DELETE`
88
+ - **URL**: `/drinks/1`
89
+
90
+ ---
91
+
92
+ ## 🛑 Note
93
+ POST and DELETE requests won't work on Hugging Face Spaces because the database is read-only. You can clone this repository and run it locally to enable all CRUD operations.
94
+
95
+ ---
96
+
97
+ ## Author
98
+ Sanjeev's Favorite Drinks API is designed to provide an interactive experience with REST API operations while sharing a taste of my favorite drinks.
99
+