import { Hono } from "hono";
import { getExchangeRates } from "../services/currency.service.ts";

const app = new Hono();

// GET / — returns current exchange rates (public, no auth required)
app.get("/", async (c) => {
	try {
		const rates = await getExchangeRates();
		return c.json(rates);
	} catch (error) {
		return c.json({ error: "Exchange rates unavailable" }, 503);
	}
});

export { app as exchangeRateRoutes };
