From 02fa0ece3299f37bcd5d0aeacb3ac633b833ecdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Qu=E1=BB=91c=20Kh=C3=A1nh?= Date: Tue, 3 Sep 2024 20:59:28 +0700 Subject: [PATCH] feat(api): expose exchange rates api to client and temporary remove secret key check (#259) --- apps/api/v1/index.ts | 4 ++-- apps/api/v1/routes/exchange-rates.ts | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/apps/api/v1/index.ts b/apps/api/v1/index.ts index bfbd6f28..bf9659c9 100644 --- a/apps/api/v1/index.ts +++ b/apps/api/v1/index.ts @@ -9,10 +9,10 @@ import usersApp from './routes/users' import walletsApp from './routes/wallets' export const hono = new Hono() - .route('/exchange-rates', exchangeRatesApp) - .use('*', authMiddleware) + .route('/exchange-rates', exchangeRatesApp) + .route('/auth', authApp) .route('/budgets', budgetsApp) .route('/categories', categoriesApp) diff --git a/apps/api/v1/routes/exchange-rates.ts b/apps/api/v1/routes/exchange-rates.ts index 1d9b271f..5d773383 100644 --- a/apps/api/v1/routes/exchange-rates.ts +++ b/apps/api/v1/routes/exchange-rates.ts @@ -7,15 +7,16 @@ import { } from '../services/exchange-rates.service' const router = new Hono() - .use(async (c, next) => { - const apiKey = c.req.header('x-api-key') + // TODO: Enable this later + // .use(async (c, next) => { + // const apiKey = c.req.header('x-api-key') - if (!apiKey || apiKey !== process.env.API_SECRET_KEY) { - return c.json({ message: 'Unauthorized' }, 401) - } + // if (!apiKey || apiKey !== process.env.API_SECRET_KEY) { + // return c.json({ message: 'Unauthorized' }, 401) + // } - await next() - }) + // await next() + // }) .get( '/',