Skip to content

Commit 722ecd3

Browse files
committed
docs: update usage
1 parent 57f0f45 commit 722ecd3

1 file changed

Lines changed: 10 additions & 17 deletions

File tree

README.md

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,37 +33,30 @@ Here's an example of how to use this package:
3333

3434
Step:
3535

36-
1. Create a swagger config with `new DocumentBuilder()`
37-
2. Generate open api document object with `SwaggerModule.createDocument(app, config)`
38-
3. Setup nodejs-api-doc with `new NodejsApiDoc`
39-
4. Start nodejs-api-doc with `nodejsApiDoc.start()`
36+
1. Modify your `src/main.ts`
37+
2. Create a swagger config with `new DocumentBuilder()`
38+
3. Generate open api document object with `SwaggerModule.createDocument(app, config)`
39+
4. Setup nodejs-api-doc with `new NodejsApiDoc`
40+
5. Start nodejs-api-doc with `nodejsApiDoc.start()`
4041

4142
```typescript
42-
// src/main.ts
43-
// define the app
44-
45-
// Define the swagger config
43+
// swagger
4644
const config = new DocumentBuilder()
47-
.setTitle('Tyre Repair Assessment API')
48-
.setDescription(
49-
'This API provides a comprehensive tyre repair assessment. It analyzes the condition of a tyre and provides recommendations for repair or replacement based on a variety of factors, such as tread depth, punctures, and wear patterns.'
50-
)
45+
.setTitle('Node.js API Docs')
46+
.setDescription('This API provides ...')
5147
.setVersion('0.0.1')
5248
.build()
53-
// Genereate the open api document object
5449
const document = SwaggerModule.createDocument(app, config)
5550

56-
// Setup the nodejs-api-doc
51+
// nodejs-api-doc
5752
const nodejsApiDoc = new NodejsApiDoc(app, document, {
5853
defaultUI: 'redoc',
5954
customPath: '/api-docs',
6055
})
61-
// Start the doc
6256
nodejsApiDoc.start()
6357

6458
// Run the nestjs
65-
const port = process.env.PORT || 8080
66-
await app.listen(port, '0.0.0.0')
59+
await app.listen(8080, '0.0.0.0')
6760
```
6861

6962
## Configuration options ⚙️

0 commit comments

Comments
 (0)