diff --git a/src/index.js b/src/index.js index defa44f..c64d4af 100644 --- a/src/index.js +++ b/src/index.js @@ -43,6 +43,12 @@ const main = async () => { next(); }); + // log incoming requests + app.use((req, res, next) => { + console.info(`${req.method} ${req.originalUrl}`); + next(); + }); + // initiate routes app.use('/v2', capacityRouter); app.use('/v2', quoteRouter); diff --git a/src/routes/capacity.js b/src/routes/capacity.js index 543ca76..7a58067 100644 --- a/src/routes/capacity.js +++ b/src/routes/capacity.js @@ -73,8 +73,6 @@ router.get( asyncRoute(async (req, res) => { const periodQuery = Number(req.query.period) || 30; - console.info(`Request: periodQuery=${periodQuery}`); - if (!Number.isInteger(periodQuery) || periodQuery < 28 || periodQuery > 365) { return res.status(400).send({ error: 'Invalid period: must be an integer between 28 and 365', response: null }); } @@ -171,8 +169,6 @@ router.get( const productId = Number(req.params.productId); const periodQuery = Number(req.query.period) || 30; - console.info(`Request: productId=${productId}, periodQuery=${periodQuery}`); - if (!Number.isInteger(periodQuery) || periodQuery < 28 || periodQuery > 365) { return res.status(400).send({ error: 'Invalid period: must be an integer between 28 and 365', response: null }); } @@ -273,8 +269,6 @@ router.get( const poolId = Number(req.params.poolId); const periodQuery = Number(req.query.period) || 30; - console.info(`Request: poolId=${poolId}, periodQuery=${periodQuery}`); - if (!Number.isInteger(periodQuery) || periodQuery < 28 || periodQuery > 365) { return res.status(400).send({ error: 'Invalid period: must be an integer between 28 and 365', response: null }); } @@ -292,7 +286,7 @@ router.get( utilizationRate: poolCapacity.utilizationRate.toNumber(), productsCapacity: poolCapacity.productsCapacity.map(productCapacity => formatCapacityResult(productCapacity)), }; - console.info('Response: ', inspect(response, { depth: null })); + console.debug('Response: ', inspect(response, { depth: null })); res.json(response); } catch (error) { @@ -351,8 +345,6 @@ router.get( const productId = Number(req.params.productId); const periodQuery = Number(req.query.period) || 30; - console.info(`Request: poolId=${poolId}, productId=${productId}, periodQuery=${periodQuery}`); - if (!Number.isInteger(periodQuery) || periodQuery < 28 || periodQuery > 365) { return res.status(400).send({ error: 'Invalid period: must be an integer between 28 and 365', response: null }); } diff --git a/src/routes/pricing.js b/src/routes/pricing.js index db6d2f2..0e69be0 100644 --- a/src/routes/pricing.js +++ b/src/routes/pricing.js @@ -62,8 +62,6 @@ router.get( asyncRoute(async (req, res) => { const productId = Number(req.params.productId); - console.info(`Request: productId=${productId}`); - if (!Number.isInteger(productId) || productId < 0) { return res.status(400).send({ error: 'Invalid productId: must be an integer', response: null }); } diff --git a/src/routes/quote.js b/src/routes/quote.js index 663849a..204c591 100644 --- a/src/routes/quote.js +++ b/src/routes/quote.js @@ -150,9 +150,6 @@ router.get( const period = BigNumber.from(req.query.period).mul(24 * 3600); const coverAsset = Number(req.query.coverAsset); - const normalizedRequestQuery = { ...req.query, amount: BigNumber.from(req.query.amount).toString() }; - console.info('Request: ', inspect(normalizedRequestQuery, { depth: null })); - const store = req.app.get('store'); const route = await quoteEngine(store, productId, amount, period, coverAsset);