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
891 stars 136 forks source link

When will Nest.js be supported? Thank you very much! #179

Open gzg1500521074 opened 2 years ago

gzg1500521074 commented 2 years ago

I mainly use nest. Js framework in my daily work. I would like to ask when it can be supported.

sangimed commented 2 years ago

You can already use it in NestJs by adding the following code to the main.ts file :

const swStats = require('swagger-stats');  
app.use(swStats.getMiddleware({ 
  swaggerSpec: document,
  authentication: true,
  onAuthenticate: function(req: any, username: string, password: string){
    // simple check for username and password
    return (
        username === 'username' &&
        password === 'password'
    );
  }
}));