Members
predefinedSpec
responseMiddlewareHasBeenApplied
used make sure the *order* of which the middlewares are applied is correct
The `response` middleware MUST be applied FIRST,
before the `request` middleware is applied.
We'll use this to make sure the order is correct.
If not - we'll throw an informative error.
Methods
handleRequests(options)
apply the `request` middleware
Applies to the `app` you provided in `handleResponses`
Also, since this is the last function you'll need to invoke,
it also initializes the specification and serves the api documentation.
The options are for these tasks.
Parameters:
| Name | Type | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
Properties
|
Returns:
void
handleResponses(expressApp, optionsopt)
apply the `response` middleware.
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
expressApp |
Express | the express app | ||||||||||||||||
options |
Object |
<optional> |
optional configuration options
Properties
|
Returns:
void
init(aApp, aPredefinedSpecopt, aPathopt, aWriteIntervalopt, aApiDocsPathopt)
initialize the `express-oas-generator`.
This will apply both `handleResponses` and `handleRequests`
and also will call `serveApiDocs`.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
aApp |
Express | the express app | ||
aPredefinedSpec |
* |
<optional> |
{}
|
|
aPath |
string | undefined |
<optional> |
where to write the openAPI specification to. Specify this to create the openAPI specification file. | |
aWriteInterval |
number |
<optional> |
10000
|
how often to write the openAPI specification to file |
aApiDocsPath |
string |
<optional> |
api-docs
|
where to serve the openAPI docs. Defaults to `api-docs` |
serveApiDocs(options)
serve the openAPI docs with swagger at a specified path / url
Parameters:
| Name | Type | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
Properties
|
Returns:
void