user1751825
user1751825

Reputation: 4309

Auto-generate swagger.yaml from hapi-js routes

I'm working with a fairly complex NodeJS API that has been written using hapiJS.

The API uses the hapi-swagger npm module to generate the API documentation.

I'm now investigating how to integrate the Amazon API Gateway with this API, in order to provide the authentication/request throttling etc.

To create an Amazon Gateway API, it appears that I need to provide a Swagger definition.

My question is, how do I generate this swagger definition? I'm assuming there must be some way to do this automatically from hapi-swagger, but I haven't been able to find it.

Upvotes: 4

Views: 852

Answers (1)

Adri Van Houdt
Adri Van Houdt

Reputation: 435

If you are using hapi-swagger the default endpoint that returns the swagger.json is /swagger.json. See https://github.com/glennjones/hapi-swagger/blob/c02dd0dc8632766006854d1a4ddcd88a77a411c8/optionsreference.md#json-json-endpoint-needed-to-create-ui --> jsonPath

Upvotes: 1

Related Questions