Add weather server in cache

This commit is contained in:
2024-09-04 23:05:41 +02:00
parent c55df1e120
commit 59b3b55656

View File

@@ -1,6 +1,6 @@
import type { OpenWeatherType, WeatherType } from '~~/types/types'
export default defineEventHandler(async (event) => {
export default defineCachedEventHandler(async (event) => {
const config = useRuntimeConfig(event)
const { user } = await requireUserSession(event)
const query = getQuery(event)
@@ -33,4 +33,7 @@ export default defineEventHandler(async (event) => {
},
wind: openWeather.wind.speed,
} as WeatherType
}, {
maxAge: 60 * 60 * 3,
name: 'weather',
})