title: How to clear cache in inversifyJS?
body: <p>I have simple application where I am using <code>express</code> server and <code>TypeScript</code> as a coding language. At first I can hit my endpoint successfully but when I change the model, I see the old data.</p>
  <p>I have tried this approach as well but no luck, <a href="https://stackoverflow.com/questions/22632593/how-to-disable-webpage-caching-in-expressjs-nodejs">How to disable webpage caching in ExpressJS + NodeJS?</a>.</p>
  <p>What am I missing here?</p>
  <ol>
  <li>My <code>index.ts</code> (main) file</li>
  </ol>
  <pre><code>/**
   * Required External Modules
   */
  import &quot;reflect-metadata&quot;
  import * as dotenv from &quot;dotenv&quot;;
  import express from &quot;express&quot;;
  import cors from &quot;cors&quot;;
  import helmet from &quot;helmet&quot;;
  import routes from &quot;./routes/routes&quot;;
  import compress from 'compression';
  const nocache = require('nocache');
  
  dotenv.config();
  
  /**
   * App Variables
   */
  if (!process.env.PORT) {
      process.exit(1);
  }
  
  const PORT: number = parseInt(process.env.PORT as string, 10);
  
  const app = express();
  
  /**
   *  App Configuration
   */
  app.use(helmet());
  app.use(cors());
  app.use(express.json());
  app.disable('x-powered-by'); // Hide information
  app.use(compress());
  // app.disable('view cache');
  // app.use((req, res, next) =&gt; {
  //     res.set('Cache-Control', 'no-store')
  //     next()
  // })
  app.use(nocache());
  routes(app);
  
  /**
   * Server Activation
   */
  app.listen(PORT, () =&gt; {
      console.log(`Listening on port ${PORT}`);
  });
  </code></pre>
  <ol start="2">
  <li><code>route</code> declartions.</li>
  </ol>
  <pre><code>import { Application } from &quot;express&quot;;
  import asyncWrap from &quot;../utils/asyncWrap&quot;;
  import HealthController from &quot;../controllers/health.controller&quot;;
  import container from &quot;../ioc.container&quot;;
  
  export default function (application: Application) {
      const healthController = container.get&lt;HealthController&gt;(HealthController);
   
      application.get('/healthStatus', asyncWrap(healthController.healthCheck.bind(healthController)));
  }
  </code></pre>
  <ol start="3">
  <li><code>asycWrap</code> logic</li>
  </ol>
  <pre><code>    import { 
          Request as ExpressRequest, 
          Response as ExpressResponse, 
          NextFunction, 
      } from 'express';
      
      // Wraps async functions, catching all errors and sending them forward to express error handler
      export default function asyncWrap(controller: CallableFunction) {
          return async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) =&gt; {
              try {
                 await controller(req, res, next);
              } catch (e) {
                  next(e);
              }
          };
      }
  </code></pre>
  <ol start="4">
  <li><code>controller</code> logic</li>
  </ol>
  <pre><code>import { inject, injectable } from &quot;inversify&quot;;
  import { HealthModel } from &quot;../models/health.model&quot;;
  import HealthService from &quot;../services/health.service&quot;;
  import { 
      Request as ExpressRequest, 
      Response as ExpressResponse, 
  } from 'express';
  
  @injectable()
  export default class HealthController {
  
      constructor(
          @inject(&quot;HealthService&quot;) private HealthService: HealthService,
      ) { }
  
      public async healthCheck(req: ExpressRequest, res: ExpressResponse): Promise&lt;HealthModel&gt; {
          const returnThis = await this.HealthService.healthCheck();
          res.send(returnThis);
          return returnThis;
      }
  }
  </code></pre>
  <ol start="5">
  <li><code>service</code> logic</li>
  </ol>
  <pre><code>import { injectable } from &quot;inversify&quot;;
  import { HealthModel } from &quot;../models/health.model&quot;;
  
  @injectable()
  export default class HealthService {
  
      public async healthCheck(): Promise&lt;HealthModel&gt; {
          const healthModel: HealthModel = {
              dateTime: new Date(),
              description: &quot;Hello WOrld&quot;,
              status: &quot;sdfadfad&quot;
          }
          return healthModel;
      }
  }
  </code></pre>
  <ol start="6">
  <li>Output (this is my old result)</li>
  </ol>
  <p><a href="https://i.stack.imgur.com/lRI2Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lRI2Q.png" alt="enter image description here" /></a></p>