Skip to content

Commit d579bd6

Browse files
improve README formatting
1 parent b55c85c commit d579bd6

File tree

1 file changed

+56
-51
lines changed

1 file changed

+56
-51
lines changed

README.md

Lines changed: 56 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Paginates result when products are fetched by categories or subcategories.
1313
Deployed as a vercel function with Postgres: [ecommerce-rest-api-five.vercel.app](https://ecommerce-rest-api-five.vercel.app)
1414
<br> Documented with Swagger UI.
1515

16+
<br/>
17+
1618
### Requirements
1719
This project is written in `Python 3.12.1`
1820

@@ -21,6 +23,8 @@ pip install -r requirements.txt
2123
```
2224
`requirements.txt` contains an adapter for PostgreSQL by default.
2325

26+
<br/>
27+
2428
### Usage
2529

2630
Copy `.env.example` and rename to `.env`. Provide your database URL to the `SQLALCHEMY_DATABASE_URI` environment variable.
@@ -46,18 +50,17 @@ flask --app app run [--debug]
4650

4751
Test the API using Swagger UI (`/` route), Postman, cURL or your preferred HTTP client.
4852

53+
<br/>
54+
4955
### Endpoints
5056

5157
#### Fetch products using name, category, subcategory
52-
- [GET] `/product/<name: string>` - Get product with name: `name`
53-
<br></br>
54-
- [GET] `/subcategory/<subcategory_id: int>/products` - Get product with within subcategory `subcategory`. Returns first page of the paginated results.
55-
<br></br>
56-
- [GET] `/subcategory/<subcategory_id: int>/products?page=<page_no>` - Get product with within subcategory `subcategory`. Returns `page_no` of the paginated results.
57-
<br></br>
58-
- [GET] `/category/<category_id: int>/products` - Get product with within category `category`. Returns first page of the paginated results.
59-
<br></br>
60-
- [GET] `/category/<category_id: int>/products?page=<page_no>` - Get product with within category `category`. Returns `page_no` of the paginated results.
58+
- [GET] `/product/<name: string>` - Get product with name: `name` <br/><br/>
59+
- [GET] `/subcategory/<subcategory_id: int>/products?page=<page_no>` - Get product with within subcategory `subcategory`. Returns `page_no` of the paginated results. <br/><br/>
60+
- [GET] `/category/<category_id: int>/products` - Get product with within category `category`. Returns first page of the paginated results. <br/><br/>
61+
- [GET] `/category/<category_id: int>/products?page=<page_no>` - Get product with within category `category`. Returns `page_no` of the paginated results. <br/><br/>
62+
63+
<br/>
6164

6265
<br></br>
6366
#### Category
@@ -66,66 +69,68 @@ Test the API using Swagger UI (`/` route), Postman, cURL or your preferred HTTP
6669
- [DELETE] `/category/(int: category_id)` - Delete category with category_id
6770

6871
- [POST] `/category/create` - Create a new category
69-
```
70-
{
71-
"name": "name",
72-
"subcategories": [<subcategory ids>] //optional
73-
}
74-
```
72+
```
73+
{
74+
"name": "name",
75+
"subcategories": [<subcategory ids>] //optional
76+
}
77+
```
7578

7679
- [PUT] `/category/(int: category_id)/update` - Update category with category_id
77-
```
78-
{
79-
"name": "name",
80-
"subcategories": [<subcategory ids>] //optional
81-
}
82-
```
80+
```
81+
{
82+
"name": "name",
83+
"subcategories": [<subcategory ids>] //optional
84+
}
85+
```
86+
87+
<br/>
8388

84-
<br></br>
8589
#### Subcategory
8690
- [GET] `/subcategories` - Get all subcategories
8791
- [GET] `/subcategory/(int: subcategory_id)` - Get subcategory with subcategory_id
8892
- [DELETE] `/subcategory/(int: subcategory_id)` - Delete subcategory with subcategory_id
8993

9094
- [POST] `/subcategory/create` - Create a new subcategory
91-
```
92-
{
93-
"name": "name",
94-
"categories": [(category ids)] //optional
95-
"products": [<product ids>] // optional
96-
}
97-
```
95+
```
96+
{
97+
"name": "name",
98+
"categories": [(category ids)], //optional
99+
"products": [<product ids>] // optional
100+
}
101+
```
98102

99103
- [PUT] `/subcategory/(int: subcategory_id)/update` - Update subcategory with subcategory_id
100-
```
101-
{
102-
"name": "name",
103-
"categories": [<category ids>] //optional
104-
"products": [<product ids>] // optional
105-
}
106-
```
104+
```
105+
{
106+
"name": "name",
107+
"categories": [<category ids>], //optional
108+
"products": [<product ids>] // optional
109+
}
110+
```
107111

108112

109-
<br></br>
113+
<br/>
114+
110115
#### Product
111116
- [GET] `/products` - Get all products
112117
- [GET] `/product/(int: product_id)` - Get product with product_id
113118
- [DELETE] `/product/(int: product_id)` - Delete product with product_id
114119

115120
- [POST] `/product/create` - Create a new product
116-
```
117-
{
118-
"name": "name",
119-
"description": "description",
120-
"subcategories": [<subcategory ids>] //optional
121-
}
122-
```
121+
```
122+
{
123+
"name": "name",
124+
"description": "description",
125+
"subcategories": [<subcategory ids>] //optional
126+
}
127+
```
123128

124129
- [PUT] `/product/(int: product_id)/update` - Update product with product_id
125-
```
126-
{
127-
"name": "name",
128-
"description": "description",
129-
"subcategories": [<subcategory ids>] //optional
130-
}
131-
```
130+
```
131+
{
132+
"name": "name",
133+
"description": "description",
134+
"subcategories": [<subcategory ids>] //optional
135+
}
136+
```

0 commit comments

Comments
 (0)