@@ -98,7 +98,7 @@ Free Open source REST API built with | Nodejs + Express + Mongodb ⚡️ Made w
9898 GET https://saddam-rest-api.herokuapp.com/api/v1/products?page=2&limit=99&sortBy=createdAt&OrderBy=desc&filterBy=category&category=Books&search=nodejs
9999```
100100
101- #### Get product
101+ #### Get single product
102102
103103``` http
104104 GET https://saddam-rest-api.herokuapp.com/api/v1/products/${id}
@@ -110,6 +110,102 @@ Free Open source REST API built with | Nodejs + Express + Mongodb ⚡️ Made w
110110
111111
112112
113+ #### Add new product (Only admins)
114+
115+ ``` http
116+ POST https://saddam-rest-api.herokuapp.com/api/v1/admin/products
117+ ```
118+
119+ | Parameter | Type | Description |
120+ | :-------- | :------- | :-------------------------------- |
121+ | ` name ` | ` string ` | ** Required** . product name|
122+ | ` price ` | ` number ` | ** Required** . product price|
123+ | ` description ` | ` string ` | ** Required** . product description|
124+ | ` productImage ` | ` img ` | ** Required** . product Image|
125+ | ` category ` | ` string ` | ** Required** . product category|
126+ | ` count ` | ` number ` | ** Optional** . default value = 1|
127+ | ` stock ` | ` string ` | ** Optional** . default value = 'in stock - order soon'|
128+
129+
130+ #### Update product (Only admins)
131+
132+ ``` http
133+ PATCH https://saddam-rest-api.herokuapp.com/api/v1/admin/products/${id}
134+ ```
135+
136+ | Parameter | Type | Description |
137+ | :-------- | :------- | :-------------------------------- |
138+ | ` id ` | ` string ` | ** Required** . Id of product to update |
139+ | ` token ` | ` string ` | ** Required** . JWT token pass in headers |
140+
141+
142+ #### Delete product (Only admins)
143+
144+ ``` http
145+ DELETE https://saddam-rest-api.herokuapp.com/api/v1/admin/products/${id}
146+ ```
147+
148+ | Parameter | Type | Description |
149+ | :-------- | :------- | :-------------------------------- |
150+ | ` id ` | ` string ` | ** Required** . Id of product to delete |
151+ | ` token ` | ` string ` | ** Required** . JWT token pass in headers |
152+
153+
154+
155+
156+ #### User signup
157+
158+ ``` http
159+ POST https://saddam-rest-api.herokuapp.com/api/v1/auth/signup
160+ ```
161+
162+ | Parameter | Type | Description |
163+ | :-------- | :------- | :-------------------------------- |
164+ | ` firstName ` | ` string ` | ** Required** .|
165+ | ` lastName ` | ` string ` | ** Required** .|
166+ | ` familyName ` | ` string ` | ** Optional** .|
167+ | ` email ` | ` string ` | ** Required** .|
168+ | ` password ` | ` string ` | ** Required** .|
169+ | ` confirmPassword ` | ` string ` | ** Required** .|
170+ | ` gender ` | ` string ` | ** Optional** .|
171+ | ` dateOfBirth ` | ` string ` | ** Optional** .|
172+ | ` acceptTerms ` | ` boolean ` | ** Required** .|
173+ | ` mobileNumber ` | ` number ` | ** Optional** .|
174+ | ` nationality ` | ` string ` | ** Optional** .|
175+ | ` favoriteAnimal ` | ` string ` | ** Optional** .|
176+ | ` address ` | ` string ` | ** Optional** .|
177+ | ` bio ` | ` string ` | ** Optional** .|
178+ | ` jobTitle ` | ` string ` | ** Optional** .|
179+
180+ ``` http
181+ After signup you will receive email to verify your account
182+ ```
183+
184+ #### User Login
185+
186+ ``` http
187+ POST https://saddam-rest-api.herokuapp.com/api/v1/auth/login
188+ ```
189+
190+ | Parameter | Type | Description |
191+ | :-------- | :------- | :-------------------------------- |
192+ | ` email ` | ` string ` | ** Required** .|
193+ | ` password ` | ` string ` | ** Required** .|
194+
195+
196+ #### User Verify Email
197+
198+ ``` http
199+ POST https://saddam-rest-api.herokuapp.com/api/v1/auth/verify-email`,
200+ ```
201+
202+ | Parameter | Type | Description |
203+ | :-------- | :------- | :-------------------------------- |
204+ | ` userId ` | ` string ` | ** Required** .|
205+ | ` token ` | ` string ` | ** Required** .|
206+
207+
208+
113209
114210# Environment
115211- To run this project, you will need to add the following environment variables to your .env file (check environment.config.js file for more examples)
0 commit comments