slanatech / swagger-stats

API Observability. Trace API calls and Monitor API performance, health and usage statistics in Node.js Microservices.
https://swaggerstats.io/
MIT License
886 stars 136 forks source link

where is the file "swagger.json" ? #274

Closed xqq965 closed 11 months ago

xqq965 commented 11 months ago

like this KOA demo : const swStats = require('swagger-stats'); const apiSpec = require('swagger.json'); const e2k = require('express-to-koa'); app.use(e2k(swStats.getMiddleware({ swaggerSpec:apiSpec })));

sv2 commented 11 months ago

It's a JSON file with your API specification in OpenAPI format. It describes your API. Like in one of the examples: https://github.com/slanatech/swagger-stats/blob/master/examples/authtest/petstore.json

It is optional, though - if you don't have API specification, you can skip passing it in parameters - swagger-stats will collect metrics based on routes in your app.