From 04a69300ecf06eab5d114068d67e7db1a41c7c95 Mon Sep 17 00:00:00 2001 From: Taha Abbasi Date: Thu, 30 Mar 2023 19:41:28 -0600 Subject: [PATCH] Added caching --- src/server.ts | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/server.ts b/src/server.ts index e743d6a..0668498 100644 --- a/src/server.ts +++ b/src/server.ts @@ -11,30 +11,9 @@ import cacheMiddleware from './cacheMiddleware'; const app = express(); const port = process.env.PORT || 8080; -// const cache = new NodeCache({ stdTTL: 60 }); // 60 seconds TTL app.use(bodyParser.json()); -// const cacheMiddleware = (duration: number) => { -// return (req: Request, res: Response, next: NextFunction) => { -// const key = req.originalUrl; -// const cachedResponse = cache.get(key); - -// if (cachedResponse) { -// res.send(cachedResponse); -// } else { -// const originalSend = res.send.bind(res); - -// res.send = ((body: any) => { -// cache.set(key, body, duration); -// originalSend(body); -// }) as Response['send']; - -// next(); -// } -// }; -// } - app.get("/totalSupplyAcrossNetworks", cacheMiddleware(60), async (req, res) => { try { const { tokenContractAddress, chainId } = req.query;