diff --git a/packages/api/src/index.ts b/packages/api/src/index.ts index b1881637..547fb009 100644 --- a/packages/api/src/index.ts +++ b/packages/api/src/index.ts @@ -8,7 +8,6 @@ import helmet from 'helmet' import cors from 'cors' import apiRouter from './routes' import { EigenExplorerApiError, handleAndReturnErrorResponse } from './schema/errors' -import { rateLimiter } from './utils/auth' const PORT = process.env.PORT ? Number.parseInt(process.env.PORT) : 3002 @@ -24,7 +23,7 @@ app.use(express.urlencoded({ extended: false })) app.use(cookieParser()) // Routes -app.use('/', rateLimiter, apiRouter) +app.use('/', apiRouter) app.get('/favicon.ico', (req, res) => res.sendStatus(204)) diff --git a/packages/api/src/routes/index.ts b/packages/api/src/routes/index.ts index a964e8a6..a900ffb1 100644 --- a/packages/api/src/routes/index.ts +++ b/packages/api/src/routes/index.ts @@ -8,6 +8,7 @@ import withdrawalRoutes from './withdrawals/withdrawalRoutes' import depositRoutes from './deposits/depositRoutes' import auxiliaryRoutes from './auxiliary/auxiliaryRoutes' import rewardRoutes from './rewards/rewardRoutes' +import { rateLimiter } from '../utils/auth' const apiRouter = express.Router() @@ -20,14 +21,14 @@ apiRouter.get('/version', (_, res) => ) // Remaining routes -apiRouter.use('/avs', avsRoutes) -apiRouter.use('/strategies', strategiesRoutes) -apiRouter.use('/operators', operatorRoutes) -apiRouter.use('/stakers', stakerRoutes) -apiRouter.use('/metrics', metricRoutes) -apiRouter.use('/withdrawals', withdrawalRoutes) -apiRouter.use('/deposits', depositRoutes) -apiRouter.use('/aux', auxiliaryRoutes) -apiRouter.use('/rewards', rewardRoutes) +apiRouter.use('/avs', rateLimiter, avsRoutes) +apiRouter.use('/strategies', rateLimiter, strategiesRoutes) +apiRouter.use('/operators', rateLimiter, operatorRoutes) +apiRouter.use('/stakers', rateLimiter, stakerRoutes) +apiRouter.use('/metrics', rateLimiter, metricRoutes) +apiRouter.use('/withdrawals', rateLimiter, withdrawalRoutes) +apiRouter.use('/deposits', rateLimiter, depositRoutes) +apiRouter.use('/aux', rateLimiter, auxiliaryRoutes) +apiRouter.use('/rewards', rateLimiter, rewardRoutes) export default apiRouter