Update README.md
Browse files
README.md
CHANGED
@@ -7,92 +7,111 @@ sdk: docker
|
|
7 |
app_file: app.py
|
8 |
pinned: false
|
9 |
---
|
|
|
10 |
|
11 |
-
|
12 |
-
|
13 |
|
14 |
-
|
15 |
|
16 |
-
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
---
|
27 |
|
28 |
-
## Database Design
|
29 |
|
30 |
-
| Column
|
31 |
-
|
32 |
-
|
|
33 |
-
|
|
34 |
-
|
|
35 |
|
36 |
---
|
37 |
|
38 |
## π How It Works
|
39 |
|
40 |
-
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.
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
---
|
90 |
|
91 |
## π Note
|
92 |
-
|
|
|
93 |
|
94 |
---
|
95 |
|
96 |
-
## Author
|
97 |
-
|
|
|
|
|
98 |
|
|
|
|
7 |
app_file: app.py
|
8 |
pinned: false
|
9 |
---
|
10 |
+
Hereβs your enhanced README file with added emojis for a fun touch:
|
11 |
|
12 |
+
```markdown
|
13 |
+
# Sanjeev's Favorite Drink API π₯€
|
14 |
|
15 |
+
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. πΉ
|
16 |
|
17 |
+
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. π«
|
18 |
|
19 |
+
---
|
20 |
+
|
21 |
+
## π API Summary
|
22 |
+
|
23 |
+
| HTTP Method | Endpoint | Description |
|
24 |
+
|-------------|-------------------|----------------------------------------------------|
|
25 |
+
| **GET** | `/` | Returns a list of all drinks. |
|
26 |
+
| **GET** | `/drinks` | Same as `/`, returns all drinks. |
|
27 |
+
| **GET** | `/drinks/<id>` | Returns details of a specific drink by its ID. |
|
28 |
+
| **POST** | `/drinks` | Add a new drink (not supported on Hugging Face). |
|
29 |
+
| **DELETE** | `/drinks/<id>` | Delete a drink (not supported on Hugging Face). |
|
30 |
|
31 |
---
|
32 |
|
33 |
+
## π Database Design
|
34 |
|
35 |
+
| Column | Type | Description |
|
36 |
+
|--------------|-----------|-------------------------------------------|
|
37 |
+
| **id** | INTEGER | Unique identifier (Primary Key). |
|
38 |
+
| **name** | STRING(80)| Name of the drink (must be unique). |
|
39 |
+
| **description** | STRING(120) | Short description of the drink. |
|
40 |
|
41 |
---
|
42 |
|
43 |
## π How It Works
|
44 |
|
45 |
+
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. π
|
46 |
+
|
47 |
+
---
|
48 |
+
|
49 |
+
## π±οΈ Usage Instructions
|
50 |
+
|
51 |
+
### 1οΈβ£ View All Drinks
|
52 |
+
**Method**: `GET`
|
53 |
+
**URL**: [https://sanjeevb1-drinks.hf.space/drinks](https://sanjeevb1-drinks.hf.space/drinks)
|
54 |
+
|
55 |
+
**Example Response**:
|
56 |
+
```json
|
57 |
+
{
|
58 |
+
"drinks": [
|
59 |
+
{
|
60 |
+
"name": "Diet Coke",
|
61 |
+
"description": "Tastes like Coke with no calories, great!!!"
|
62 |
+
},
|
63 |
+
{
|
64 |
+
"name": "Fanta",
|
65 |
+
"description": "Like the taste and color of it"
|
66 |
+
}
|
67 |
+
]
|
68 |
+
}
|
69 |
+
```
|
70 |
+
|
71 |
+
---
|
72 |
+
|
73 |
+
### 2οΈβ£ View a Specific Drink
|
74 |
+
**Method**: `GET`
|
75 |
+
**URL**: [https://sanjeevb1-drinks.hf.space/drinks/1](https://sanjeevb1-drinks.hf.space/drinks/1)
|
76 |
+
|
77 |
+
**Example Response**:
|
78 |
+
```json
|
79 |
+
{
|
80 |
+
"name": "Diet Coke",
|
81 |
+
"description": "Tastes like Coke with no calories, great!!!"
|
82 |
+
}
|
83 |
+
```
|
84 |
+
|
85 |
+
---
|
86 |
+
|
87 |
+
### 3οΈβ£ Add a New Drink (π« Not Supported on Hugging Face Spaces)
|
88 |
+
**Method**: `POST`
|
89 |
+
**URL**: `/drinks`
|
90 |
+
**Body (JSON)**:
|
91 |
+
```json
|
92 |
+
{
|
93 |
+
"name": "Mango Juice",
|
94 |
+
"description": "Sweet and refreshing"
|
95 |
+
}
|
96 |
+
```
|
97 |
+
|
98 |
+
---
|
99 |
+
|
100 |
+
### 4οΈβ£ Delete a Drink (π« Not Supported on Hugging Face Spaces)
|
101 |
+
**Method**: `DELETE`
|
102 |
+
**URL**: `/drinks/1`
|
103 |
|
104 |
---
|
105 |
|
106 |
## π Note
|
107 |
+
|
108 |
+
β οΈ **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. π»
|
109 |
|
110 |
---
|
111 |
|
112 |
+
## π€ Author
|
113 |
+
|
114 |
+
Sanjeev's Favorite Drinks API is designed to provide an interactive experience with REST API operations while sharing a taste of my favorite drinks. πΉ Cheers! π₯
|
115 |
+
```
|
116 |
|
117 |
+
Let me know if you need further adjustments! π
|