Skip to content

Commit a928654

Browse files
committed
Update: Added nodemon and SwaggerJS
1 parent 64bf12e commit a928654

File tree

2 files changed

+57
-11
lines changed

2 files changed

+57
-11
lines changed

.idea/swagger-settings.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 57 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ Welcome to **Fusion Electronics**, a **MERN-Stack E-commerce Application**! This
2020
8. [Running the Application](#running-the-application)
2121
9. [Testing the APIs](#testing-the-apis)
2222
10. [Swagger API Documentation](#swagger-api-documentation)
23-
11. [Deployment](#deployment)
24-
12. [Containerization](#containerization)
25-
13. [Contributing](#contributing)
26-
14. [License](#license)
27-
15. [Creator](#creator)
23+
11. [OpenAPI Specification](#openapi-specification)
24+
- [Using the `openapi.yaml` File](#using-the-openapiyaml-file)
25+
12. [Deployment](#deployment)
26+
13. [Containerization](#containerization)
27+
14. [Contributing](#contributing)
28+
15. [License](#license)
29+
16. [Creator](#creator)
2830

2931
## Introduction
3032

@@ -307,6 +309,56 @@ Before running this project, ensure you have the following installed:
307309
<img src="docs/swagger-ui.png" alt="The MovieVerse App Interface" style="border-radius: 10px" width="100%"/>
308310
</p>
309311
312+
## OpenAPI Specification
313+
314+
### Using the `openapi.yaml` File
315+
316+
1. **View the API Documentation**
317+
- Open [Swagger Editor](https://editor.swagger.io/).
318+
- Upload the `openapi.yaml` file or paste its content.
319+
- Visualize and interact with the API documentation.
320+
321+
2. **Test the API**
322+
- Import `openapi.yaml` into [Postman](https://www.postman.com/):
323+
- Open Postman → Import → Select `openapi.yaml`.
324+
- Test the API endpoints directly from Postman.
325+
- Or use [Swagger UI](https://swagger.io/tools/swagger-ui/):
326+
- Provide the file URL or upload it to view and test endpoints.
327+
328+
3. **Generate Client Libraries**
329+
- Install OpenAPI Generator:
330+
```bash
331+
npm install @openapitools/openapi-generator-cli -g
332+
```
333+
- Generate a client library:
334+
```bash
335+
openapi-generator-cli generate -i openapi.yaml -g <language> -o ./client
336+
```
337+
- Replace `<language>` with the desired programming language.
338+
339+
4. **Generate Server Stubs**
340+
- Generate a server stub:
341+
```bash
342+
openapi-generator-cli generate -i openapi.yaml -g <framework> -o ./server
343+
```
344+
- Replace `<framework>` with the desired framework.
345+
346+
5. **Run a Mock Server**
347+
- Install Prism:
348+
```bash
349+
npm install -g @stoplight/prism-cli
350+
```
351+
- Start the mock server:
352+
```bash
353+
prism mock openapi.yaml
354+
```
355+
356+
6. **Validate the OpenAPI File**
357+
- Use [Swagger Validator](https://validator.swagger.io/):
358+
- Upload `openapi.yaml` or paste its content to check for errors.
359+
360+
This guide enables you to view, test, and utilize the API. You can generate client libraries, server stubs, and run a mock server using the OpenAPI Specification.
361+
310362
## Deployment
311363

312364
To deploy the application:

0 commit comments

Comments
 (0)