blob: 6e14da82ee94ca519e4c612697e49739e84891b2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import { g } from "$lib/db";
import { rate } from "$lib/rates";
export default {
async fx(c) {
const { fx } = await g("fx");
c.header("Cache-Control", "public, max-age=300");
return c.json({ fx });
},
async last(c) {
c.header("Cache-Control", "public, max-age=30");
return c.json(rate || (await g("rate")));
},
async index(c) {
const { date, fx, ...rates } = await g("rates");
c.header("Cache-Control", "public, max-age=30");
return c.json(rates);
},
};
|