You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<palign="center">A progressive <ahref="http://nodejs.org"target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<ahref="https://opencollective.com/nest#backer"target="_blank"><imgsrc="https://opencollective.com/nest/backers/badge.svg"alt="Backers on Open Collective" /></a>
27
-
28
-
<ahref="https://opencollective.com/nest#sponsor"target="_blank"><imgsrc="https://opencollective.com/nest/sponsors/badge.svg"alt="Sponsors on Open Collective" /></a>
3. Create a Cloudinary account with this [link](https://cloudinary.com/users/register_free)
64
+
84
65
4. Navigate to your dashboard in your Cloudinary account and copy the following Environment Variables.
85
66
86
67
```
68
+
87
69
//Cloudinary Environment Variables
88
70
71
+
72
+
89
73
CLOUDINARY_NAME=[Enter your Cloudinary name here]
90
74
75
+
76
+
91
77
CLOUDINARY_KEY=[Enter your Cloudinary key here]
92
78
79
+
80
+
93
81
CLOUDINARY_SECRET= [Enter your Cloudinary secret here]
82
+
94
83
```
95
84
96
85
Once you have copied your unique Environment Variables, paste them into your `.env` file as shown in the code above.
@@ -99,40 +88,60 @@ Once you have copied your unique Environment Variables, paste them into your `.e
99
88
100
89
```bash
101
90
91
+
92
+
102
93
$ npm install
103
94
95
+
96
+
104
97
```
105
98
106
99
## Running the app
107
100
108
101
```bash
109
102
103
+
104
+
110
105
# development
111
106
107
+
108
+
112
109
$ nest start --watch
113
110
111
+
112
+
114
113
# production mode
115
114
115
+
116
+
116
117
$ npm run start:prod
117
118
119
+
120
+
118
121
```
119
122
120
123
Once the application is running, your terminal should display a message similar to:
121
124
122
125
```
126
+
123
127
Inventor application is running on: http://[::1]:3888
128
+
124
129
```
125
130
126
131
Here, `3888` is the port number on which the application is running. This port number depends on the value you specify in your `.env` file under the `PORT` variable:
127
132
128
133
```
134
+
129
135
PORT=[YOUR_PORT_NUMBER]
136
+
130
137
```
131
138
132
139
To access the Swagger documentation for the API endpoints, open your web browser and navigate to the following URL, replacing `3888` with your specified port number:
133
140
134
141
```
142
+
135
143
http://[::1]:[YOUR_PORT_NUMBER]/docs/api
144
+
136
145
```
137
146
138
147
This URL will take you to the Swagger interface, where you can explore and interact with the API endpoints.
@@ -156,23 +165,41 @@ The first step is to register a new user. This is required to create an account
156
165
**Request Body:**
157
166
158
167
````
168
+
159
169
```json
170
+
160
171
{
172
+
161
173
"email": "string",
174
+
162
175
"password": "string",
176
+
163
177
"firstName": "string",
178
+
164
179
"lastName": "string",
180
+
165
181
"joinMethod": "SIGN_UP",
182
+
166
183
"location": {
167
-
"type": "Point",
168
-
"coordinates": [
169
-
"longitude",
170
-
"latitude"
171
-
]
184
+
185
+
"type": "Point",
186
+
187
+
"coordinates": [
188
+
189
+
"longitude",
190
+
191
+
"latitude"
192
+
193
+
]
194
+
172
195
},
196
+
173
197
"deviceId": "string",
198
+
174
199
"deviceToken": "string"
200
+
175
201
}
202
+
176
203
````
177
204
178
205
### 2. Verify the User
@@ -185,6 +212,8 @@ To verify the user using the Swagger documentation, you'll need to provide the *
185
212
186
213
```
187
214
215
+
216
+
188
217
```
189
218
190
219
### 3. Log In
@@ -196,38 +225,56 @@ Once the user is verified, you can log in to obtain an authentication token.
196
225
**Request Body:**
197
226
198
227
```
228
+
199
229
{
200
-
"email": "string",
201
-
"password": "string"
230
+
231
+
"email": "string",
232
+
233
+
"password": "string"
234
+
202
235
}
236
+
203
237
```
204
238
205
239
**Response:** The response will contain an authentication token, which you will use for authenticated requests.
206
240
207
241
```
242
+
208
243
{
244
+
209
245
"access_token": "your_auth_token",
246
+
210
247
"_id": "your_userId",
248
+
211
249
"email": "your_email_address",
250
+
212
251
"firstName": "your_firstname",
252
+
213
253
"lastName": "your_lastname",
254
+
214
255
"role": [ "USER" ]
256
+
215
257
}
258
+
216
259
```
217
260
218
261
### 4. Add the Auth Token to Swagger
219
262
220
263
To interact with the secured endpoints in the Swagger documentation, you need to add the obtained authentication token.
221
264
222
-
1. Open the Swagger documentation for your API.
223
-
2. Click on the **Authorize** button (usually a padlock icon) at the top of the page.
224
-
3. In the popup that appears, enter your authentication token in the appropriate field. The format usually is:
265
+
1. Open the Swagger documentation for your API.
266
+
267
+
2. Click on the **Authorize** button (usually a padlock icon) at the top of the page.
268
+
269
+
3. In the popup that appears, enter your authentication token in the appropriate field. The format usually is:
225
270
226
271
```
272
+
227
273
Bearer your_auth_token
274
+
228
275
```
229
276
230
-
4.Click **Authorize** to apply the token.
277
+
4. Click **Authorize** to apply the token.
231
278
232
279
With the authentication token added, you can now interact with the secured endpoints in the Swagger documentation. The token will be included in the `Authorization` header of your requests.
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
0 commit comments