import { Elysia } from 'elysia' import { Eta } from "eta" import Meteostanica from '../../utils/meteostanica' const eta = new Eta({ views: "./templates" }) export default (langName, lang) => new Elysia({ prefix: `/history` }) .get('/', ({ set }) => { set.headers['content-type'] = 'text/html; charset=utf8' return eta.render(`${langName}/history/index`, { }) }) .get(`/:property`, ({ params: { property }, set }) => { const data = Meteostanica.getDataProperty(property) if (!data) { set.headers['content-type'] = 'text/html; charset=utf8' return eta.render(`${langName}/history/notFound`, { property }) } set.headers['content-type'] = 'text/html; charset=utf8' return eta.render(`${langName}/history/property`, { lang, property, data }) })